Closed enkot closed 3 months ago
Thanks! Should be fixed in v1.9.11
@harlan-zw Unfortunately it still doesn't work as expected( You can check this repro https://stackblitz.com/edit/github-yhnmge-zfah8i?file=app.vue If you run it you will see in the console:
2. after beforeInit
1. beforeInit
Expected:
1. beforeInit
2. after beforeInit
Looks like beforeInit
is running in the async context for some reason 👀
This may be a documentation/usage issue from here, beforeInit
should only run if the script is actually going to be loaded, so it's executed right before the script tag is inserted.
In Nuxt's case that's after the hydration occurs as the DOM render is indeed async.
Would you mind providing some context on the issue you're having, maybe there's some logic I've overlooked.
You are right, makes sense, I was using it incorrectly :) Thank you for the explanation! Closing this issue.
Environment
Reproduction
https://stackblitz.com/edit/github-yhnmge-s1db7e?file=app.vue
Describe the bug
Currently
beforeInit
is always running server-side even if the trigger is set toclient
, so this example from the docs doesn't work in SSR:I suggest running
beforeInit
on the server side only if thetrigger
is set toserver
or on the client only.Additional context
No response
Logs
No response