solid-query: EFFECT_RELAY_TEAR on Solid 2 when a query key changes — useBaseQuery relays the result through a version signal written from a render effect · Issue #11903 · TanStack/query · GitHub
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
solid-query: EFFECT_RELAY_TEAR on Solid 2 when a query key changes — useBaseQuery relays the result through a version signal written from a render effect #11903
With Solid 2 (solid-js@2.0.0-rc.13) and @tanstack/solid-query@6.0.0-rc.4 (the useBaseQuery code is identical in 6.0.0-rc.5), switching the query key of a useQuery logs a reactivity diagnostic from @solidjs/diagnostics@2.0.0-rc.13:
[EFFECT_RELAY_TEAR] memo "computed" ran twice for one write of "tariff": once in the flush where "tariff" changed,
and again after effect "effect" relayed it by writing "signal" — the first frame showed the new "tariff" with the stale "signal".
If "signal" is computed from what the effect reads, make it a memo so readers get it in the same flush;
if the write reads something outside the graph (layout, time), the tear is the cost of measuring.
Owner path: <QueryClientProvider> › <provider> › computed › <Price> › computed — the only user code is a createMemo reading query.data. One diagnostic per useQuery instance whose key changed (a screen with five queries logs five).
Solid 2 dev builds treat these diagnostics as actionable (the console is expected to stay clean), so every app that derives anything from query.data and ever changes a key gets a warning it cannot fix on its side.
When the key changes, defaultedOptions is recomputed in the same flush as the key signal; readers of query.data see the new options with the old observer result, then the render effect calls observer.setOptions, the cache event bumps version, and every memo downstream recomputes a second time. That is exactly the "effect relays a derived value by writing a signal" pattern the diagnostic describes: version is derived from what the effect reads, so the first frame is torn.
Both keys are already in the cache, so no fetch is involved — the second recompute is purely the version relay.
Steps to reproduce
Mount a component with useQuery whose key depends on a signal, and a createMemo reading query.data.
Change the signal (with @solidjs/diagnostics capturing, attribution on).
Observe EFFECT_RELAY_TEAR for the memo.
Expected behavior
Changing a query key should produce one consistent frame: the result for the new key arrives in the same flush as the key (e.g. the observer result derived as a memo / projection of the options instead of being relayed through a counter signal written from a cache subscription), or the diagnostic should not fire for useQuery consumers.
Platform
OS: macOS 13
Browser: Brave (Chromium), also reproduces under vitest + jsdom
Hit this too, and there's a second symptom that comes from the same relay.
When the key goes back to a key whose cached data is stale (default staleTime: 0), so a refetch happens, and the query sits under <Loading>, Solid also logs ABANDONED_FLIGHTS next to EFFECT_RELAY_TEAR. A router does exactly this when the same page component gets a new param and you then press Back.
Versions: @tanstack/solid-query 6.0.0-rc.5, @tanstack/query-core 5.101.4, solid-js, @solidjs/signals and @solidjs/web 2.0.0-rc.14, Vite 8.1.4, Chromium 149 dev build.
import{QueryClient,QueryClientProvider,useQuery}from"@tanstack/solid-query";import{createSignal,Loading}from"solid-js";import{render}from"@solidjs/web";constclient=newQueryClient();letcalls=0;constfetcher=(key: string)=>newPromise<string>((resolve)=>setTimeout(()=>resolve(`${key}${++calls}`),40));const[key,setKey]=createSignal("a");functionTally(){constquery=useQuery(()=>({queryKey: ["tally",key()],queryFn: ({ queryKey })=>fetcher(String(queryKey[1]))}));return<spanid="tally">{query.data}</span>;}render(()=>(<QueryClientProviderclient={client}><Loadingfallback={<span>loading</span>}><Tally/></Loading></QueryClientProvider>),document.getElementById("app")!,);// Three times: setKey("b"), wait 100 ms, setKey("a"), wait 1.5 s.
Dev console, 2 runs out of 2:
[ABANDONED_FLIGHTS] "computed" abandoned 3 flights in 1000ms: each was superseded by the next before it landed, so every input asked again and the answers were discarded.
[EFFECT_RELAY_TEAR] memo "computed" ran twice for one write of "key": once in the flush where "key" changed, and again after effect "effect" relayed it by writing "signal" (3 times so far).
The data ends up right (7 fetches for 1 + 3x2 key changes). The extra reads are flights the next run throws away, because the computed first sees the new key with the old observer result and only settles after the effect writes the new result into the signal.
A few things I checked:
No router or view transition needed. It also happens inside document.startViewTransition with a sync flush().
Remounting a stale query without changing its key doesn't warn.
Remounting per key avoids it (a keyed <Show> around the component), which is what we do for now.
So deriving the result in the same flush as the options, as suggested in the issue, should fix both warnings.
Activity
lovrozagar commentedon Oct 14, 2026
Hit this too, and there's a second symptom that comes from the same relay.
When the key goes back to a key whose cached data is stale (default
staleTime: 0), so a refetch happens, and the query sits under<Loading>, Solid also logsABANDONED_FLIGHTSnext toEFFECT_RELAY_TEAR. A router does exactly this when the same page component gets a new param and you then press Back.Versions:
@tanstack/solid-query6.0.0-rc.5,@tanstack/query-core5.101.4,solid-js,@solidjs/signalsand@solidjs/web2.0.0-rc.14, Vite 8.1.4, Chromium 149 dev build.Dev console, 2 runs out of 2:
The data ends up right (7 fetches for 1 + 3x2 key changes). The extra reads are flights the next run throws away, because the computed first sees the new key with the old observer result and only settles after the effect writes the new result into the signal.
A few things I checked:
document.startViewTransitionwith a syncflush().<Show>around the component), which is what we do for now.So deriving the result in the same flush as the options, as suggested in the issue, should fix both warnings.
fix(bit-15): every doc slug has a feedback tally, and a failing widge…
refactor(bit-15): the docs feedback tally drops its keyed remount