samgomena / avanti

Website for the restaurant.
https://avantiwestlinn.com
3 stars 0 forks source link

Gallery page errors on reload #159

Closed samgomena closed 2 years ago

samgomena commented 2 years ago

This error appears to have surfaced after the upgrade to react 18. It looks like this:

Uncaught Error: Minified React error #418; visit https://reactjs.org/docs/error-decoder.html?invariant=418 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

I think this is happening due to the Masonry component which dynamically calculates column widths after hydration but Next's Image component sets styles server side. The error occurs because Masonry changes the layout and the Image components styles change on the first render. Anecdotally, the error is difficult (impossible?) to reproduce on screen widths where the column count isn't increased/decreased on the first render.