Async page options #8969
CapitaineToinon
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there!
I was wondering if there was any plan to add the posibility to have async page options. Basically having the possibility to export a function instead of a simple boolean. The use case I'm personally thinking of would by conditionnal client side rendering.
Imagine your frontpage has interactive content but requires you to be logged in for those interactive bits to work. Right now, you have no choice but enable CSR for the page even if anonymous won't need any javascript. For example this simple page:
Would break for logged in users if CSR is turned off. My idea would be to allow CSR to accept a function, similar to a load function.
Looking a bit at the code, it seems like the render function that actually gets the page options also have access to the current event and could therefore be passed down to the nodes instead through a function.
kit/packages/kit/src/runtime/server/page/index.js
Lines 303 to 318 in b915dfe
Any thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions