-
-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Labels
Description
Description
I'd be nice if the mere existence of +onCreatePageContext.server.js doesn't trigger pageContext.json requests, see:
- https://vike.dev/pageContext.json#avoid-pagecontext-json-requests
- data.shared.ts no client request when using vikeVuePinia #2929 (comment)
But it would break the authentication use case, see:
- https://vike.dev/auth#pagecontext-user
/examples/auth/- [failed-attempt] fix: don't request pageContext.json if only +onCreatePageContext.server.ts exists #2936
- afb7587#diff-40ba24b7b18212a063d1d629965369c658812ba8115a8a045d93d686b9e55b2a
So far, the only solution I see it to create some new hook that is like onCreatePageContext (also called very early) but that triggers a pageContext.json request.
Using something like +data.pre.js (pre meaning order: 'pre') wouldn't work for the authentication use case because +guard (and potentially other hooks) needs auth information.