Skip to content

fix: refetch queries after a refreshAll navigation when the cached query survives it - #16546

Draft
Nic-Polumeyv wants to merge 6 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-remote-query-reset-lost-v3
Draft

fix: refetch queries after a refreshAll navigation when the cached query survives it#16546
Nic-Polumeyv wants to merge 6 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-remote-query-reset-lost-v3

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Replaces #16453 now that main is winding down; fixes #16444.

#promise ??= this.#run() compiles to an unconditional $.set (sveltejs/svelte#18592), so a render that evaluates while the resetting batch from a refreshAll navigation is still pending reads the pre-reset promise through the batch overlay and writes it straight back, erasing the reset. The deferred restart in client.js then sees a non-null promise and never refetches. Whether the cached query survives the navigation at all is GC timing, which is why this mostly shows up in Firefox.

This affects any refreshAll navigation: remote form redirects, applyAction, goto(url, { refreshAll: true }). Verified against the reproduction in #16444 on version-3 in Firefox: 10/10 stale before, 0/10 after, with the ??= line being the only difference. The spec fails without the runtime change.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 27, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 993601d:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/993601d23b8b9ffbc84c72f17c78dfc3a2371400

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

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 Jul 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 993601d

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

@Nic-Polumeyv Nic-Polumeyv changed the title fix: refetch queries after a redirect when the cached query survives the navigation fix: refetch queries after a refreshAll navigation when the cached query survives it Jul 28, 2026
@Nic-Polumeyv
Nic-Polumeyv force-pushed the fix-remote-query-reset-lost-v3 branch from b2e55e5 to 4df372e Compare August 1, 2026 03:09
@Rich-Harris

Copy link
Copy Markdown
Member

I think we should probably close this in favour of sveltejs/svelte#18594 (just waiting for CI to run on that and we can cut a release)

@Nic-Polumeyv

Nic-Polumeyv commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

I'm going to put this in draft to test if #16444 is fully fixed at a later date. Unless you've already tested this and want to close it.

@Nic-Polumeyv
Nic-Polumeyv marked this pull request as draft August 19, 2026 02:48
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.

Remote form redirect sometimes does not refresh queries in Firefox

2 participants