Deploy preview different to npm run preview with material ui badge component

Hidden and not added to DOM are 2 different things. In your code, the item should not be added to the DOM based on the condition. However, it is being added, so the condition is working fine.

As for why it works locally, can’t say. I don’t have your code, nor can I troubleshoot it.