"Hydration text content mismatch" error causes faulty state after pushing to an array #2304
-
Reproductionhttps://stackblitz.com/edit/nuxt-starter-upur5z?file=app.vue Steps to reproduce the bugLoad the page (observe that the html is rendered correctly initially) Expected behaviorThe page should show Actual behaviorThe page shows Additional information
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is because you are pushing both in the server and then on the client but since the client already hydrates the state that was sent from the server, it ends up adding another The solution depends on your actual code: a Set, pushing only on server with |
Beta Was this translation helpful? Give feedback.
This is because you are pushing both in the server and then on the client but since the client already hydrates the state that was sent from the server, it ends up adding another
test
.The solution depends on your actual code: a Set, pushing only on server with
if (process.server)
or ensuring this kind of initialization is only done once with a flag on the store