You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe there is an opportunity to do something like this:
// The context object provided by the Auth.js universal middlewareconstcontextAuth={user: {id: 42,name: 'Auth.js'},sessionExpire: '2025-01-01'}// Object containing extra infos about contextAuth, created by unimid/universal-middlewareconstsource={type: 'universalMiddlewares',name: 'Auth.js',value: contextAuth,// Not sure if easily possible, maybe by parsing a dummy `new Error().stack`definedAt: '/server/authjs-handler.ts'}// The "big" context object that contains everything, created by unimid/universal-middlewareconstcontext={
...contextAuth,// ... (all other context objects set by other universal middlewares)source: {user: source,sessionExpire: source},from: {// or unimiduniversalMiddlewares: {['Auth.js']: source}}}// context.user => easy access to value// context.source.user => to know where context.user comes from// context.from.universalMiddlewares['Auth.js'] => to know what the Auth.js universal middlewares sets
Clearly not important for now, but could be worth it to already start with such foundation.
I'm even thinking of renaming Vike's pageContext to context. The idea here is that most (junior-ish) users won't (want to) understand the differences between pageContext and context. Having a single context object that contains everything is quite a lovely DX.
Having that insight at the beginning of Vike would have been neat.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Maybe there is an opportunity to do something like this:
Clearly not important for now, but could be worth it to already start with such foundation.
FYI on Vike's side:
pageContext
vikejs/vike#1268pageContext
tocontext
. The idea here is that most (junior-ish) users won't (want to) understand the differences betweenpageContext
andcontext
. Having a single context object that contains everything is quite a lovely DX.Having that insight at the beginning of Vike would have been neat.
Beta Was this translation helpful? Give feedback.
All reactions