Skip to content

fix: settle a query's pending request in place on set() - #16958

Merged
Rich-Harris merged 2 commits into
version-3from
query-latest-bookkeeping
Aug 27, 2026
Merged

Rich-Harris merged 2 commits into
version-3from
query-latest-bookkeeping

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Query#run settles a request by resolving the older resolvers in #latest and leaves its own behind, so #latest is never empty once a request has settled. set() resolves everything in #latest and then replaces #promise unconditionally. When a value arrives through set() while the request is pending, the normal path for single-flight responses (remote_request in shared.svelte.js), awaiting consumers settle twice: through the resolved promise, then again when the new #promise invalidates #then. The second settlement runs in a new batch while the first is still applying, deriveds lose memoization across the two, and a deep graph downstream of the query recomputes exponentially (#16854).

#run() now removes its own resolver when it settles, so #latest holds exactly the pending requests, and set() only replaces #promise when nothing was pending.

Fixes #16854

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from a39c730:

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

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

@changeset-bot

changeset-bot Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a39c730

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

@svelte-docs-bot

Copy link
Copy Markdown

@Rich-Harris
Rich-Harris merged commit f6d44cf into version-3 Aug 27, 2026
40 checks passed
@Rich-Harris
Rich-Harris deleted the query-latest-bookkeeping branch August 27, 2026 20:21
teemingc pushed a commit that referenced this pull request Sep 8, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to version-3, this PR
will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-3` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `version-3`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @sveltejs/[email protected]

### Major Changes

- breaking: populate env vars before `instrumentation.server.js` is
evaluated and update the adapter instrumentation API
([#16303](#16303))

- breaking: remove cloudflare `platform`, emulate the
`cloudflare:workers` module instead
([#16754](#16754))

- breaking: replace the `builder.generateManifest` with
`builder.generateServerInstance` and `builder.manifest`
([#16875](#16875))

### Patch Changes

- Updated dependencies
[[`9a4b343`](9a4b343),
[`ee2f55b`](ee2f55b),
[`65673a4`](65673a4),
[`1b79845`](1b79845),
[`b12bb78`](b12bb78),
[`03f1687`](03f1687),
[`49f0808`](49f0808),
[`e7c74bf`](e7c74bf),
[`0876d63`](0876d63),
[`9a2b9ba`](9a2b9ba),
[`c9f54b5`](c9f54b5),
[`22b8152`](22b8152),
[`f6d44cf`](f6d44cf),
[`3c3a27b`](3c3a27b),
[`7f376b1`](7f376b1),
[`8a587c7`](8a587c7),
[`aa4f960`](aa4f960)]:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Major Changes

- breaking: populate env vars before `instrumentation.server.js` is
evaluated and update the adapter instrumentation API
([#16303](#16303))

- breaking: replace the `builder.generateManifest` with
`builder.generateServerInstance` and `builder.manifest`
([#16875](#16875))

### Patch Changes

- fix: route requests with omitted optional parameters to split
serverless functions
([#17020](#17020))

- fix: copy `_redirects` when deploying edge function
([#17047](#17047))

- chore: replace `@iarna/toml` with `smol-toml`
([#16948](#16948))

- chore: identify serverless functions with a UUID instead of Netlify's
function token ([#17044](#17044))

- fix: ensure serverless function files have unique names
([#17049](#17049))
- Updated dependencies
[[`9a4b343`](9a4b343),
[`ee2f55b`](ee2f55b),
[`65673a4`](65673a4),
[`1b79845`](1b79845),
[`b12bb78`](b12bb78),
[`03f1687`](03f1687),
[`49f0808`](49f0808),
[`e7c74bf`](e7c74bf),
[`0876d63`](0876d63),
[`9a2b9ba`](9a2b9ba),
[`c9f54b5`](c9f54b5),
[`22b8152`](22b8152),
[`f6d44cf`](f6d44cf),
[`3c3a27b`](3c3a27b),
[`7f376b1`](7f376b1),
[`8a587c7`](8a587c7),
[`aa4f960`](aa4f960)]:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Major Changes

- breaking: populate env vars before `instrumentation.server.js` is
evaluated and update the adapter instrumentation API
([#16303](#16303))

- breaking: replace the `builder.generateManifest` with
`builder.generateServerInstance` and `builder.manifest`
([#16875](#16875))

### Patch Changes

- Updated dependencies
[[`9a4b343`](9a4b343),
[`ee2f55b`](ee2f55b),
[`65673a4`](65673a4),
[`1b79845`](1b79845),
[`b12bb78`](b12bb78),
[`03f1687`](03f1687),
[`49f0808`](49f0808),
[`e7c74bf`](e7c74bf),
[`0876d63`](0876d63),
[`9a2b9ba`](9a2b9ba),
[`c9f54b5`](c9f54b5),
[`22b8152`](22b8152),
[`f6d44cf`](f6d44cf),
[`3c3a27b`](3c3a27b),
[`7f376b1`](7f376b1),
[`8a587c7`](8a587c7),
[`aa4f960`](aa4f960)]:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Major Changes

- breaking: populate env vars before `instrumentation.server.js` is
evaluated and update the adapter instrumentation API
([#16303](#16303))

- breaking: replace the `builder.generateManifest` with
`builder.generateServerInstance` and `builder.manifest`
([#16875](#16875))

### Patch Changes

- fix: pass the requested pathname, including any trailing slash, to ISR
functions ([#16903](#16903))

- fix: trace `process.cwd()`-relative files from the project directory
and never glob from the filesystem root
([#16972](#16972))
- Updated dependencies
[[`9a4b343`](9a4b343),
[`ee2f55b`](ee2f55b),
[`65673a4`](65673a4),
[`1b79845`](1b79845),
[`b12bb78`](b12bb78),
[`03f1687`](03f1687),
[`49f0808`](49f0808),
[`e7c74bf`](e7c74bf),
[`0876d63`](0876d63),
[`9a2b9ba`](9a2b9ba),
[`c9f54b5`](c9f54b5),
[`22b8152`](22b8152),
[`f6d44cf`](f6d44cf),
[`3c3a27b`](3c3a27b),
[`7f376b1`](7f376b1),
[`8a587c7`](8a587c7),
[`aa4f960`](aa4f960)]:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Major Changes

- major: error when a client-requested single-flight mutation isn't
respected by the server, allow the server to explicitly ignore refreshes
([#16892](#16892))

- breaking: remove `Server` constructor and `SSRManifest` from public
types ([#16876](#16876))

- breaking: replace the `builder.generateManifest` with
`builder.generateServerInstance` and `builder.manifest`
([#16875](#16875))

### Minor Changes

- feat: allow adapters to receive the Svelte config as a function
argument when adding Vite plugins
([#16986](#16986))

- feat: allow adapters to override `getRequest` and `setResponse` during
`vite dev` and `vite preview`
([#16753](#16753))

### Patch Changes

- fix: respect `paths.relative` during development for client files
([#17053](#17053))

- fix: clarify circular imports from `src/env`
([#17014](#17014))

- breaking: populate env vars before `instrumentation.server.js` is
evaluated and update the adapter instrumentation API
([#16303](#16303))

- fix: record a history traversal before resolving its route
([#16959](#16959))

- fix: support coordinate objects from image inputs in remote forms
([#16944](#16944))

- fix: walk and copy directories without a stat per file
([#16995](#16995))

- fix: widen remote form fields for union schemas and string enums
([#16937](#16937))

- fix: respond to `HEAD` requests without a body
([#17036](#17036))

- chore: replace deprecated Vite dev server APIs
([#16961](#16961))

- fix: settle a query's pending request in place when its value arrives
through `set()` ([#16958](#16958))

- fix: prevent `await_reactivity_loss` warning and
`state_unsafe_mutation` error when the new version detector runs after
an `await` ([#16915](#16915))

- chore: parse page options and remote modules with Vite's `parseSync`
instead of `acorn`
([#16947](#16947))
## @sveltejs/[email protected]

### Minor Changes

- feat: add zero-config deployment support for Render
([#16850](#16850))

### Patch Changes

- Updated dependencies
[[`9a4b343`](9a4b343),
[`ee2f55b`](ee2f55b),
[`65673a4`](65673a4),
[`1b79845`](1b79845),
[`b12bb78`](b12bb78),
[`03f1687`](03f1687),
[`49f0808`](49f0808),
[`e7c74bf`](e7c74bf),
[`0876d63`](0876d63),
[`9a2b9ba`](9a2b9ba),
[`c9f54b5`](c9f54b5),
[`22b8152`](22b8152),
[`f6d44cf`](f6d44cf),
[`3c3a27b`](3c3a27b),
[`7f376b1`](7f376b1),
[`8a587c7`](8a587c7),
[`aa4f960`](aa4f960)]:
  - @sveltejs/[email protected]
## @sveltejs/[email protected]

### Patch Changes

- chore: read the Svelte config via `@sveltejs/load-config`
([#17039](#17039))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
dadezzz added a commit to dadezzz/events-cash-register that referenced this pull request Oct 5, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@sveltejs/kit](https://svelte.dev) ([source](https://github.com/sveltejs/kit/tree/HEAD/packages/kit)) | [`2.70.3` → `3.0.0`](https://renovatebot.com/diffs/npm/@sveltejs%2fkit/2.70.3/3.0.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@sveltejs%2fkit/3.0.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@sveltejs%2fkit/2.70.3/3.0.0?slim=true) |

---

### Release Notes

<details>
<summary>sveltejs/kit (@&#8203;sveltejs/kit)</summary>

### [`v3.0.0`](https://github.com/sveltejs/kit/blob/HEAD/packages/kit/CHANGELOG.md#300)

[Compare Source](https://github.com/sveltejs/kit/compare/@sveltejs/[email protected]...@sveltejs/[email protected])

##### Major Changes

- breaking: move remote function types to `$app/server` ([#&#8203;16740](sveltejs/kit#16740))

- breaking: remove `experimental.handleRenderingErrors` flag ([#&#8203;16265](sveltejs/kit#16265))

- breaking: make `getRequest` and `setResponse` synchronous ([#&#8203;16280](sveltejs/kit#16280))

- breaking: TypeScript 6 is now the minimum required version ([#&#8203;15930](sveltejs/kit#15930))

- breaking: refresh all load functions/queries when clicking a link to the current URL ([#&#8203;16572](sveltejs/kit#16572))

- breaking: move remote function types to `$app/server` ([#&#8203;16764](sveltejs/kit#16764))

- breaking: upgrade to `cookie` v2. Cookie names must now contain only ASCII characters ([#&#8203;13386](sveltejs/kit#13386))

- breaking: require Node 22 or newer ([#&#8203;12548](sveltejs/kit#12548))

- major: error when a client-requested single-flight mutation isn't respected by the server, allow the server to explicitly ignore refreshes ([#&#8203;16892](sveltejs/kit#16892))

- breaking: remove the `preloadStrategy` option. `modulepreload` will always be used ([#&#8203;15256](sveltejs/kit#15256))

- breaking: default the cookie `path` option to `'/'` ([#&#8203;15398](sveltejs/kit#15398))

- breaking: remove `@sveltejs/kit/node/polyfills` ([#&#8203;15430](sveltejs/kit#15430))

- breaking: add `config.kit.output.linkHeaderPreload` to preload using the `Link` header ([#&#8203;15939](sveltejs/kit#15939))

- breaking: require `@sveltejs/vite-plugin-svelte` v7 ([#&#8203;15371](sveltejs/kit#15371))

- breaking: make `page.url` immutable on a type level ([#&#8203;16256](sveltejs/kit#16256))

- breaking: remove `base`, `assets`, and `resolveRoute` from `$app/paths` ([#&#8203;15507](sveltejs/kit#15507))

- breaking: remove `createEntries` from the `Builder` object passed to adapter functions ([#&#8203;15509](sveltejs/kit#15509))

- breaking: return no content for 204 responses ([#&#8203;16200](sveltejs/kit#16200))

- breaking: rename `Pathname` type to `Path` and `Asset` to `AssetPath` ([#&#8203;16430](sveltejs/kit#16430))
  breaking: remove leading `/` from `Path` and `AssetPath`

- breaking: `handle`'s `resolve` is now typed to always return a `Promise` ([#&#8203;16352](sveltejs/kit#16352))

- breaking: remove `Server` constructor and `SSRManifest` from public types ([#&#8203;16876](sveltejs/kit#16876))

- breaking: require Svelte config options to be passed through the Vite plugin ([#&#8203;16007](sveltejs/kit#16007))

- breaking: form action responses now use the HTTP status code returned from `fail` ([#&#8203;16200](sveltejs/kit#16200))

- breaking: write tsconfig to `node_modules/$app/tsconfig` ([#&#8203;16458](sveltejs/kit#16458))

- breaking: move `defineParams` and associated types to `@sveltejs/kit/params` ([#&#8203;16716](sveltejs/kit#16716))

- breaking: remove the deprecated CSRF `checkOrigin` option in favor of `trustedOrigins` ([#&#8203;15437](sveltejs/kit#15437))

- breaking: the `delta` property now only exists for `popstate` navigation events ([#&#8203;15522](sveltejs/kit#15522))

- breaking: change `form.error` type from `any` to `App.Error | undefined` ([#&#8203;16245](sveltejs/kit#16245))

- breaking: remove deprecated `pragma` header in version polling for improved CORS support ([#&#8203;15428](sveltejs/kit#15428))

- breaking: `goto` now rejects when called with a URL that does not resolve to a route within the app, matching the existing behaviour for external URLs ([#&#8203;16164](sveltejs/kit#16164))

- breaking: run all errors through the `handleError` hook ([#&#8203;16664](sveltejs/kit#16664))

- breaking: require Svelte 5.56.4 or newer ([#&#8203;15371](sveltejs/kit#15371))

- breaking: error on `event.url`, `event.params` and `event.route` access inside queries ([#&#8203;16452](sveltejs/kit#16452))

- breaking: enhanced cross-page form actions now navigate to the action page on success and failure, matching native form behavior ([#&#8203;16684](sveltejs/kit#16684))

- breaking: delete `$service-worker` module ([#&#8203;16450](sveltejs/kit#16450))

- breaking: move `defineEnvVars` to `@sveltejs/kit/env` ([#&#8203;16375](sveltejs/kit#16375))

- breaking: nested server-only directories ([#&#8203;15685](sveltejs/kit#15685))

- feat: allow adapters to provide additional Vite plugins ([#&#8203;16206](sveltejs/kit#16206))

- breaking: replace the `$lib` alias with `#lib` and remove `files.lib` config. ([#&#8203;16360](sveltejs/kit#16360))

- breaking: remove `#lib` definition from `paths`; requires explicit module extensions as a result ([#&#8203;16736](sveltejs/kit#16736))

- chore: change `error`, `isHttpError`, `redirect`, and `isRedirect` to refer to public type instead of internal class ([#&#8203;13036](sveltejs/kit#13036))

- breaking: move hooks-related types to `@sveltejs/kit/hooks` ([#&#8203;16737](sveltejs/kit#16737))

- breaking: add 'error' result type to `preloadData` ([#&#8203;12579](sveltejs/kit#12579))

- breaking: detect new deployments on data, remote, and form action responses, tab focus, and visibility change, and default `version.pollInterval` to 1 hour ([#&#8203;16496](sveltejs/kit#16496))

- breaking: disallow cross-origin form submissions without a `Content-Type` header ([#&#8203;16347](sveltejs/kit#16347))

- breaking: Server-only directories (`/server/` in the path) are now treated as server-only everywhere inside the project (except `src/routes` and the assets directory) ([#&#8203;16360](sveltejs/kit#16360))

- breaking: `config` exported from a universal route file takes precedence over a server one ([#&#8203;16400](sveltejs/kit#16400))

- breaking: require Vite 8. Provides new functionality even for existing Vite 8 users such as faster builds with Vite hook filters and more powerful SvelteKit adapters with the Vite environment API ([#&#8203;15371](sveltejs/kit#15371))

- breaking: remove `data-sveltekit-*` option `'off'` in favour of `false` ([#&#8203;15907](sveltejs/kit#15907))

- breaking: move tracing out of the experimental namespace and remove the instrumentation flag ([#&#8203;16260](sveltejs/kit#16260))

- breaking: add `kit.paths.origin` config option, remove `kit.prerender.origin` and the `adapter-node` `ORIGIN` environment variable ([#&#8203;16161](sveltejs/kit#16161))

- breaking: move `Page`, `ReadonlyURL` and `ReadonlyURLSearchParams` from `@sveltejs/kit` to `$app/state` ([#&#8203;16694](sveltejs/kit#16694))

- breaking: remove `$app/stores` ([#&#8203;15499](sveltejs/kit#15499))

- breaking: add `refreshAll` and deprecate `invalidateAll` ([#&#8203;16289](sveltejs/kit#16289))

- breaking: reject query parameters beginning with `x-sveltekit-` ([#&#8203;17125](sveltejs/kit#17125))

- breaking: disallow `*.remote.ts/js` files unless `experimental.remoteFunctions` is enabled ([#&#8203;16247](sveltejs/kit#16247))

- breaking: replace the `noScroll` and `keepFocus` options of `goto` with a single `reset` option, and the `data-sveltekit-noscroll` and `data-sveltekit-keepfocus` attributes with `data-sveltekit-reset` ([#&#8203;16558](sveltejs/kit#16558))

- breaking: don't abort navigation when calling `invalidate(All)` during navigation ([#&#8203;16188](sveltejs/kit#16188))

- breaking: consistent special filename patterns ([#&#8203;16382](sveltejs/kit#16382))

- breaking: allow `handleError` to influence status code ([#&#8203;16162](sveltejs/kit#16162))

- breaking: delegate CORS handling to Vite for static directory requests during development ([#&#8203;16357](sveltejs/kit#16357))

- breaking: require `vite@^8.0.12`, the first Vite 8 release bundling stable `rolldown` 1.0.0 ([#&#8203;16134](sveltejs/kit#16134))

- breaking: only include routes with a `+page` or `+server` in `RouteId` ([#&#8203;16580](sveltejs/kit#16580))

- breaking: require Node 22.17 ([#&#8203;16597](sveltejs/kit#16597))

- breaking: deprecate `error(status, {...})` in favour of `error(status, message, {...})` ([#&#8203;16540](sveltejs/kit#16540))

- breaking: replace the `builder.generateManifest` with `builder.generateServerInstance` and `builder.manifest` ([#&#8203;16875](sveltejs/kit#16875))

- breaking: forbid external redirects by default ([#&#8203;16198](sveltejs/kit#16198))

- breaking: separate adapter Vite plugins into `pre` and `post` ([#&#8203;16711](sveltejs/kit#16711))

- breaking: remove param files in folder in favor of `params.js/ts` file ([#&#8203;16189](sveltejs/kit#16189))

- breaking: move env-related types to `@sveltejs/kit/env` ([#&#8203;16739](sveltejs/kit#16739))

- breaking: `preloadCode` now takes a route ID (e.g. `/blog/[slug]`) instead of a pathname. Route IDs are not prefixed with `paths.base` ([#&#8203;16576](sveltejs/kit#16576))

- breaking: move `BeforeNavigate`, `OnNavigate`, `AfterNavigate`, `Navigation`, `NavigationTarget`, `NavigationType`, `GotoOptions` and the `Navigation*` variant types from `@sveltejs/kit` to `$app/navigation` ([#&#8203;16694](sveltejs/kit#16694))

- breaking: move `ActionResult` and `SubmitFunction` from `@sveltejs/kit` to `$app/forms` ([#&#8203;16694](sveltejs/kit#16694))

- breaking: remove `handleValidationError` and pass remote function validation errors to `handleError` with `kind: 'validation'` ([#&#8203;16672](sveltejs/kit#16672))

- breaking: remove deprecated `.run()` method from live queries ([#&#8203;16573](sveltejs/kit#16573))

##### Minor Changes

- feat: allow hyphens in param and matcher names ([#&#8203;16284](sveltejs/kit#16284))

- feat: add `$app/manifest` module with `immutable`, `assets`, `prerendered`, and `routes` exports ([#&#8203;16372](sveltejs/kit#16372))

- feat: ignore files with + prefix if they contain test/spec/stories ([#&#8203;16715](sveltejs/kit#16715))

- feat: add `ErrorProps` to generated types ([#&#8203;16272](sveltejs/kit#16272))

- feat: support sourcemaps in production ([#&#8203;16412](sveltejs/kit#16412))

- feat: return the list of compressed files from `builder.compress` ([#&#8203;16566](sveltejs/kit#16566))

- feat: better response logging ([#&#8203;16744](sveltejs/kit#16744))

- feat: warn when tsconfig doesn't exclude service worker ([#&#8203;16645](sveltejs/kit#16645))

- feat: validate that all remote form fields were created with form.fields.foo.as(...) ([#&#8203;16331](sveltejs/kit#16331))

- feat: support function validators for environment variables ([#&#8203;16402](sveltejs/kit#16402))

- feat: use `type: 'module'` for service worker registrations ([#&#8203;16169](sveltejs/kit#16169))

- feat: allow adapters to receive the Svelte config as a function argument when adding Vite plugins ([#&#8203;16986](sveltejs/kit#16986))

- feat: add shallow routing to `goto` and deprecate `pushState` and `replaceState` ([#&#8203;16449](sveltejs/kit#16449))

- feat: abort `request.signal` when the response closes prematurely, via a new `response` option for `getRequest` ([#&#8203;16793](sveltejs/kit#16793))

- feat: make `$app/paths` importable in service workers ([#&#8203;16441](sveltejs/kit#16441))

- feat: pass the project-relative source `filename` to the `preload` filter for fonts ([#&#8203;16443](