chore: keep the call context on the event view instead of cloning the request state - #16968
Open
Nic-Polumeyv wants to merge 4 commits into
Open
chore: keep the call context on the event view instead of cloning the request state#16968Nic-Polumeyv wants to merge 4 commits into
Nic-Polumeyv wants to merge 4 commits into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/1dd3e6051c49e972f04888dd1e4cc2701e6f71f6Open in |
|
Nic-Polumeyv
force-pushed
the
request-context
branch
from
August 27, 2026 23:31
727ebe8 to
57e9cc0
Compare
Nic-Polumeyv
force-pushed
the
request-context
branch
from
August 28, 2026 00:28
57e9cc0 to
d77baa8
Compare
Nic-Polumeyv
marked this pull request as ready for review
August 28, 2026 03:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RequestStatecarries five booleans that are not about the request.is_in_render,is_in_remote_query,is_in_remote_prerender,is_in_remote_form_or_commandandis_in_remote_functionsay what kind of code is on the stack, and the only way to flip one is to clone the whole state object and re-enter the store with the copy, at 11 sites and twice per query call. It only stays correct because every field mutated inside remote code lives understate.remote, which the spread shares by reference.Kit already builds a per-call view of the event for remote functions (
derive_remote_function_event, which makesurlthrow inside a query), so the kind of code running is a property of that view.derive_event(event, context)now builds every view and keeps the flags in a non-enumerable__on it, the same idiom remote functions use for their internals;get_context(event)reads them. The flags accumulate through nested derivations exactly as the spreads did, so behaviour is unchanged, andRequestStatekeeps only per-request data.allow_cookieswas every caller restating the same fact by hand (no cookies inside a query or prerender), so it is now derived from the context.