Skip to content

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

Open
elliott-with-the-longest-name-on-github wants to merge 5 commits into
version-3from
elliott/warn-missing-refreshes

Conversation

@elliott-with-the-longest-name-on-github

@elliott-with-the-longest-name-on-github elliott-with-the-longest-name-on-github commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

closes #16839

Prior to the PR, client-requested single-flight mutations had a weird inconsistency. When calling requested(query, limit), queries that exceeded limit would be failed by the server -- the server would generate a failure response for each one of them and send it back to the client. However, if requested wasn't called at all, we would just do... nothing. Your queries would just not refresh and you wouldn't know about it unless you happened to notice.

In addition to the inconsistency, the design was silly. The error for a missed refresh is the same for every query. The client already knows which queries were requested. So the server doesn't need to send back information about them! The client can just diff its list of requested refreshes with the response!

This PR addresses the two issues:

  • Any client-requested updates that aren't honored by the server will produce errors. These errors will now be generated on the client.
  • The server can intentionally ignore refreshes (basically saying "this didn't change" or "you don't actually need to update") by calling ignore:
for (const { arg, query, ignore } of requested(query, 5)) {
  if (was_updated(arg)) {
    void query.refresh();
  } else {
    ignore();
  }
}

If you just want to ignore a query altogether, there's a similar shorthand: requested(...).ignoreAll().

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 21, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 96d1afa:

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

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

@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 96d1afa

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 Major

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

Comment thread packages/kit/src/runtime/client/remote-functions/shared.svelte.js
@elliott-with-the-longest-name-on-github elliott-with-the-longest-name-on-github changed the title feat: Warn in dev when the client requests refreshes that the server doesn't fulfill breaking: error when a client-requested single-flight mutation isn't respected by the server, allow the server to explicitly ignore refreshes Aug 22, 2026
Change version of @sveltejs/kit from minor to major and update the feature description.
@svelte-triage-bot

Copy link
Copy Markdown

I investigated this failed test run and found that test/client.test.js:831:2 › remote function mutations › form reconnect updates targeted live query without reconnecting all live queries is flaky.

The primary test used a timing-sensitive server cleanup counter despite traces showing the form response and targeted reconnect succeeded; it is stabilized by asserting observable reconnect requests. The separate flaky batch retry arose from module-level todo state leaking across retries and is fixed by resetting that state before baseline assertions. I opened #16896 with a proposed fix.

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.

Warn when a requested refresh is dropped

1 participant