https://github.com/HapLifeMan/nuxt-ssr-created-issue
yarn run dev
and see an error in full pageyarn run build && yarn run start
and see that works but throws an error in the consoleIt is expected that the created
hook is only executed once (from the SSR only) if the page is loaded from the server.
The created
hook is running on server-side AND client-side when loading a page.
If we mutate a variable in the created
, the server-side will do it correctly, but when the client-side will do it, as the variable has been already mutated, it will not recognize it and throw an error.
It throws a full-page error in dev environment but only displays an error in the console in prod.
Thanks!
This is intended behavior. beforeCreate
and created
are called on server and on client side :wink:
Further read:
Hi @manniL, then I will change the way I developed it, thanks for your reply! 馃槉
Most helpful comment
This is intended behavior.
beforeCreate
andcreated
are called on server and on client side :wink:Further read: