Skip to content

fix: allow requested() in a command called from other server code - #17040

Open
kdelay wants to merge 2 commits into
sveltejs:version-3from
kdelay:fix/issue-17035-command-requested-outside-remote-request
Open

fix: allow requested() in a command called from other server code#17040
kdelay wants to merge 2 commits into
sveltejs:version-3from
kdelay:fix/issue-17035-command-requested-outside-remote-request

Conversation

@kdelay

@kdelay kdelay commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #17035.

requested() throws as soon as a command runs outside a /_app/remote/... request, e.g. when a +server.js handler calls it. Since #15991 is_in_remote_form_or_command is set only by the remote endpoint, so "inside a command" means "the request arrived at that endpoint".

The wrapper marks the context itself again, the way query.bind sets is_in_remote_query. Such a request has no client cache to update, so requested() yields nothing and refreshAll() is a no-op instead of throwing.

#16968 replaces this flag and fixes the same regression on the way: on 8ff8bc6 the three tests here pass unchanged. If it lands first, keep the tests and drop the runtime change.

Testing

test:unit (the first new test fails without the fix), lint, check, prepublishOnly, and the test-async remote suite.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 5, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 62fa98f:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/62fa98f27dd77f0c4e92432cc085e75e1680d929

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17040

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b768d38

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sveltejs sveltejs deleted a comment from coderabbitai Bot Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

requested() throws when a command is called from server code (e.g. +server.ts) since 2.65.0 / #15991, unlike query.refresh() which no-ops

2 participants