You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 99ed6cf
Browse filesBrowse the repository at this point in the historyBrowse files
committed
fix(query): don't cache never-settling promises from hydration tracking runs
A hydrating client re-runs each serialized compute once as a tracking run,
with the global Promise and fetch swapped for stubs that never settle
(solid's subFetch). The first query() read of a key usually lands there,
and two paths cached one of those stubs:
- Adoption (since #641) wrapped an already-settled flight entry with the
global Promise.resolve/reject, so the cache held a stub. Navigations that
reused it inside the preload window hung with isRouting() stuck. Adopted
entries are now wrapped with Promise captured at module load.
- f513771 stamps adopted entries at boot and lets reads with no navigation
in flight adopt at any age, but the cache-hit check never got that rule.
A boundary resuming more than PRELOAD_TIMEOUT after boot, after the first
reader was disposed (count 0), saw the entry as stale, found the one-shot
payload already taken, and ran fn() inside the tracking run. A read with
no navigation in flight while hydrating (isHydrating()) now reuses the
cached entry at any age. Navigations keep normal freshness.
Tests: unit cases for both rules, plus an SSR-stream + hydration JSDOM
harness (adapted from #636 by @everton-dgn) covering the round trip after
adoption in a tracking run, a boundary resuming 6s after boot for fetch-chain
and async query functions (no fn call, no requests), a mid-stream click past
the window, and isHydrating() inside the late boundary's tracking run.
Fixessolidjs/solid#3721.
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Fix navigations hanging after hydration when a `query()` read ran inside Solid's hydration tracking run, where the global `Promise` and `fetch` are swapped for stubs that never settle (solidjs/solid#3721). Adopting a server value that had already settled wrapped it with that stubbed `Promise`, so the cache kept a promise that never settled. A boundary resuming more than 5s after boot treated the entry adopted at boot as stale and called the query function inside the tracking run, caching the same kind of promise. Adopted values are now wrapped with the native `Promise`, and a read with no navigation in flight while hydrating reuses the cached entry at any age, as adoption already did for server payloads. Navigations keep the normal freshness windows.
0 commit comments