-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
ssrContext effectively read-only in app:rendered hook 3.0.0-rc.7 #14537
Copy link
Copy link
Closed
nuxt/framework
#6521Closed
Copy link
Labels
Description
Environment
- Operating System:
Darwin - Node Version:
v16.15.0 - Nuxt Version:
3.0.0-rc.7 - Package Manager:
npm@8.13.2 - Builder:
vite - User Config:
- - Runtime Modules:
- - Build Modules:
-
Reproduction
https://stackblitz.com/edit/github-2wanhk?file=plugins/test.client.ts
Describe the bug
Not sure if this is a bug or if it is intentional. However, in the previous version of the app:rendered hook the ssrContext was mutable.
Using the app:rendered hook you can access the HTML including ssrContext, however, you cannot mutate its value. It seems like the HTML is already generated at this point, and no longer mutable.
nuxtApp.hook('app:rendered', ({ssrContext}) => { ssrContext.payload.state.test = 'test'; });
console.log(window.__NUXT__.state.test) -> undefined
Additional context
No response
Logs
No response
Reactions are currently unavailable