Closed bdrtsky closed 3 years ago
Hi @bdrtsky. Thanks for the issue and PR. I think using universal storage for SSG handling is probably not the best way because the SSR version is already rendered with either white or dark. Plugin executes on Client-side which is too late and causes a screen-flash/re-render to change the theme. Probably it would be better using a sync script to inject data-theme
class to the body :)
When in development everything works perfectly. But after I build app with
npm run generate
it ignores local state and overwrite it withinitialState
.I made reproduction - https://github.com/bdrtsky/universal-module-issue
If you change
theme
in select, then in dev when you refresh the page previous selection preserved, like it's expected. But in prod withgenerate
theme
overwritten byinitialState
.