feat: hydratable and a more consistent remote functions model#15533
Merged
elliott-with-the-longest-name-on-github merged 41 commits intomainfrom Mar 17, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 95fdd23 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Rich-Harris
reviewed
Mar 11, 2026
packages/kit/src/runtime/client/remote-functions/prerender.svelte.js
Outdated
Show resolved
Hide resolved
6 tasks
packages/kit/src/runtime/client/remote-functions/query.svelte.js
Outdated
Show resolved
Hide resolved
…rowser consoles
This commit fixes the issue reported at packages/kit/src/runtime/client/remote-functions/query.svelte.js:58
**Bug Explanation:**
Three debug console.log statements were left in the production code at:
* Line 58: `console.log(cache_key + ' bypassed hydratable');`
* Line 292: `console.log(this._key, 'serving from the cache');`
* Line 295: `console.log(this._key, 'made it past the cache');`
These statements appear to be development debugging aids that were not removed before committing. The codebase has a clear pattern for console.log usage:
1. In build/CLI tools (acceptable since those run in Node.js during development)
2. Guarded by `DEV` checks for runtime code (e.g., line 671 in respond.js uses `if (DEV && ...) { console.log(...) }`)
The unguarded console.log statements in query.svelte.js would execute on every query run/cache check in production, spamming end users' browser consoles with internal debugging messages like "query-key serving from the cache" and "query-key bypassed hydratable".
**Fix:**
Removed all three debug console.log statements since they serve no purpose for production users and were clearly left in accidentally (evidenced by commit messages like "i think it work" indicating development-in-progress code).
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: elliott-with-the-longest-name-on-github <hello@ell.iott.dev>
Rich-Harris
reviewed
Mar 13, 2026
packages/adapter-netlify/test/apps/split/src/routes/remote/query/+page.svelte
Show resolved
Hide resolved
Rich-Harris
reviewed
Mar 13, 2026
Rich-Harris
reviewed
Mar 13, 2026
Rich-Harris
reviewed
Mar 13, 2026
…om:sveltejs/kit into elliott/remote-functions-hydratable-take-2
phi-bre
reviewed
Mar 16, 2026
Rich-Harris
reviewed
Mar 17, 2026
Rich-Harris
reviewed
Mar 17, 2026
Rich-Harris
approved these changes
Mar 17, 2026
Member
Rich-Harris
left a comment
There was a problem hiding this comment.
LGTM! nice work. only unresolved comment is about whether we want to merge #15555 or not. i leave it up to you
03670ad
into
main
29 checks passed
12 tasks
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.
This PR makes a number of substantial changes to how remote queries work.
hydratableImplementation-wise, it replaces our custom transport solution with
hydratablefor queries that are used during render -- this method of transport is more correct and prevents us from accidentally using stale data for queries in a small subset of cases. There's one breaking side effect of this: If you didn't render a query on the server, you can't render it during hydration.It means this:
would throw during hydration because
get_counttried to access cached data that did not exist. This is almost always an undesirable mistake: It means you introduced a waterfall on the client and blocked hydration. If you really do want this, you'd do something like this instead:New rules around query usage
From now on, on the client, you can only access a query's data if that query is:
It may be easier to illustrate when you can't create and use a query on the client:
loadWe're making this change because otherwise it's basically impossible to reliably cache queries across your app. However, for most use cases, this probably doesn't cause any pain:
.refresh,.set,.withOverrideare all availablequery().run(), which will return a plain oldPromiseresolving to your dataBugfixes
$effect.rootwhen created. This prevents them from associating with their parent effect, making their usage more predictable when retrieved from the cache.refreshis now a noop if there is no cached instance of the query, meaning you won't have a useless query request in some circumstanceshydratable!)