'Material UI Dialog not working in production - shows a blank page
I've installed serve
and have run npm run build
. When I start the application everything's working except the dialogs i.e. when I open them I get a blank white screen and an error:
react-dom.production.min.js:156 Uncaught TypeError: Cannot read property 'length' of undefined
at ri (2.3c107e85.chunk.js:2)
at gi (2.3c107e85.chunk.js:2)
at Object.Oi [as useEffect] (2.3c107e85.chunk.js:2)
at Object.t.useEffect (2.3c107e85.chunk.js:2)
at w (2.3c107e85.chunk.js:2)
at S (2.3c107e85.chunk.js:2)
at 2.3c107e85.chunk.js:2
at ai (2.3c107e85.chunk.js:2)
at Ni (2.3c107e85.chunk.js:2)
at Vu (2.3c107e85.chunk.js:2)
If I start the application with the normal setup i.e. without serve, the dialogs start to work as expected. I'm not sure what's causing this.
Solution 1:[1]
I'm having the same problem and I solved using the variable condition "openFlag" as a condition rendering, like this:
{ openFlag && <Dialog open={openFlag}> ... </Dialog>}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Raul de Araújo |