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
[2.0 / next] A memo that read latest(x) last run holds a Loading on switch even when its new run no longer reads x #4661
A memo outside a <Loading on={f()}> reads f() and, in the branch taken before the switch, latest(() => list()). When f changes, the new run takes the other branch and does not read list at all. The switch is still held silently until list's new answer lands, so the Loading on fallback never shows and the old content stays on screen. The same memo with untrack in place of latest doesn't hold. A memo that always reads latest(() => list()) doesn't hold either. It holds whether the memo is read by an effect or by a view outside the boundary.
const[f,setF]=createSignal("open");constlist=createMemo(()=>ask(`list:${f()}`));// a promise per keyconstcount=createMemo(()=>f()==="open" ? latest(()=>list().length) : -1);createEffect(()=>count(),v=>{seen=v;});return<Loadingfallback={<i>first</i>}><Loadingon={f()}fallback={<i>loading {f()}</i>}><b>{list().join(",")}</b></Loading></Loading>;
Steps: land list:open = [1,2,3], then setF("closed") and flush.
variant
after the switch, in flight
expected
f() === "open" ? latest(() => list().length) : -1, read by an effect
When list:closed lands, every variant shows 9 and the count -1.
How we found it: ReactiveScript's checker suggests "read latest x here" for a reader outside a loading on(k) region. An app counting open issues, filter == "open" ? (latest shown).length : -1, still froze on the filter switch. Three agents hit it independently and each spent several turns working around it.
Activity
perf(signals): track #4661's read-ahead readers with one list, no Wea…
fix(signals): a memo's plain read of a flight after its latest() wind…
fix(signals): a latest() read of a flight does not hold a Loading on …