Document session: false opt-out and session runtime tree-shaking - #14251
Document session: false opt-out and session runtime tree-shaking#14251adamchal wants to merge 4 commits into
session: false opt-out and session runtime tree-shaking#14251Conversation
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Preview deployment ✅ Deployment complete!
|
87eec16 to
ffce409
Compare
ArmandPhilippot
left a comment
There was a problem hiding this comment.
I was waiting for Matt's block to be resolved before reviewing this PR in case anything change (so don't worry, it will be review in time!). So, this isn't a full review yet (I haven't checked the implementation), but here's a first pass!
Overall this looks good to me - thank you - but I think some parts could be improved to match our existing style (e.g. callout) and help everyone (including non native speaker) reading the English version (multiple if in a single sentence).
Co-authored-by: Adam Chalemian <adam@chal.net> Co-authored-by: Armand Philippot <git@armand.philippot.eu>
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Except a nit, this LGTM and I won't block the PR for this! Thank you for handling the docs PR and the updates! 🙌🏽
| // ...render pipeline... | ||
| ``` | ||
|
|
||
| This handler registers no provider when no session driver is configured, or when [sessions are disabled](/en/guides/sessions/#disabling-sessions). In both cases, `ctx.session` will be `undefined`. |
There was a problem hiding this comment.
I'm torn about this. Can't we say "Registers the session provider when a driver is configured." (first sentence)?
I mean, "ctx.session is undefined when no session is configured" is the expected behavior. It makes sense to explain what this entails on the adapter pages, but I feel that here, it doesn't add any extra information.
There was a problem hiding this comment.
I don’t like how it reads either. But, I do like how we are reiterating the requirements/conditions for sessions being defined. That said, do we really need to be so verbose here? My only argument for keeping it would be that someone visiting the FetchState docs should be aware/reminded of this. Idk though. I don’t have a good suggestion or compromise.
There was a problem hiding this comment.
Yeah, sorry, I should have specified that I’m mainly conflicted about the second sentence. Someone using sessions already has a way of knowing this and it might not be useful to repeat that (ie. we could repeat that everywhere we mention sessions...).
But, if you think this is helpful, I'm okay with that! I don't have a better idea and, as I said, this is non-blocking anyway.
Accompanies withastro/astro#16871.
Description (required)
Documents withastro/astro#16871, which adds a
session: falseconfig option to opt out of session support entirely, and tree-shakes the session runtime (AstroSession+unstorage) out of the SSR bundle for any project where no session driver is wired.Changes (English only):
guides/sessions.mdx: new "Disabling sessions" section (<Since v="7.2.0" />) covering thesession: falseoption, that adapters skip wiring their default driver, thatAstro.session/context.sessionareundefined(same as a project without sessions configured, soAstro.session?.get()feature detection keeps working), and a note that the runtime is tree-shaken automatically for any driver-less project even without the flag.reference/api-reference.mdx:sessiontype corrected toAstroSession | undefined, and the disabled case added to the list of situations wheresessionisundefined.guides/integrations-guide/cloudflare.mdx: note in the Sessions section thatsession: falsemeans no KV binding is configured, no KV namespace is provisioned on deploy, and the session runtime is excluded from the Worker bundle.guides/integrations-guide/netlify.mdx: note thatsession: falsemeans Netlify Blobs is not configured for session storage and the runtime is excluded from the function bundle.guides/integrations-guide/node.mdx: note thatsession: falsemeans the filesystem driver is not configured and the runtime is excluded from the server bundle.reference/modules/astro-fetch.mdx: note on thesessions()pipeline handler that it registers no provider (andctx.sessionisundefined) when no driver is configured or sessions are disabled.References
session: falseto opt out of session support astro#168717.2.0(and@astrojs/cloudflare14.2.0,@astrojs/netlify8.2.0,@astrojs/node11.1.0)Discord username: adam.chal