diff --git a/ref/SOLID_NEXT b/ref/SOLID_NEXT index c16100d7..acba4500 100644 --- a/ref/SOLID_NEXT +++ b/ref/SOLID_NEXT @@ -1 +1 @@ -c467fcd7f9f0ded3e6158409c9c148ece79e1aa1 +30e7805eb1bbd9e2601d0252558e91d2547e96f4 diff --git a/ref/compile/rt-server.ts b/ref/compile/rt-server.ts index 41722958..29c04711 100644 --- a/ref/compile/rt-server.ts +++ b/ref/compile/rt-server.ts @@ -141,7 +141,7 @@ export function createApp(opts: { api?: Record unknown> question(name: string, compute: (prev: unknown) => unknown, o: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean; derived?: boolean; record?: boolean; plain?: boolean }, key?: string): [Acc, Writer] { const fn = named(name, compute); const derive = (draft: any) => { const r = fn(draft); if (r instanceof Flight || r instanceof Promise) return (async () => landDraft(draft, r instanceof Flight ? await r.first : await r, key))(); return landDraft(draft, r, key); }; - if (mode.optimistic && mode.structured && mode.plain && !mode.derived) { const [truth] = (createStore as any)(derive, key && !mode.record ? [] : {}, key ? { key } : undefined); (createOptimisticStore as any)(() => (key && !mode.record ? [] : {}), key && !mode.record ? [] : {}, key ? { key } : undefined); return ro(() => truth); } // the client's layer, created for its owner slot only: the server shows the truth (it has no guesses). A server layer over the pending truth would hydrate as an answer of its own, and the client's layer would stop following the truth (solidjs/solid#5146) + if (mode.optimistic && mode.structured && mode.plain && !mode.derived) { const seed = () => (key && !mode.record ? [] : {}); const [truth] = (createStore as any)(derive, seed(), key ? { key } : undefined); const [view] = (createOptimisticStore as any)(() => truth, seed(), key ? { key } : undefined); return ro(() => view); } // AC-3 over a plain-written question: the client's layer over the truth, so the owner trees (and hydration keys) match if (mode.optimistic && mode.structured) { const [store] = (createOptimisticStore as any)(derive, key && !mode.record ? [] : {}, key ? { key } : undefined); return ro(() => store); } if (mode.optimistic && mode.derived) { const [get] = createOptimistic(fn as any, o as any); return ro(get as Acc); } // AC-3 over an equation: the client's createOptimistic(fn), so the owner trees (and hydration keys) match if (mode.optimistic) { const [truth] = createSignal(fn as any, o as any); const [get] = createOptimistic(() => (truth as Acc)()); return ro(get as Acc); } diff --git a/ref/oracle/repros/proj-hydrate/run.mjs b/ref/oracle/repros/proj-hydrate/run.mjs index a67bdf13..8fe99555 100644 --- a/ref/oracle/repros/proj-hydrate/run.mjs +++ b/ref/oracle/repros/proj-hydrate/run.mjs @@ -1,6 +1,6 @@ // node repros/proj-hydrate/run.mjs (from ref/oracle) // createOptimisticStore(() => truth) over an async createStore. The server renders "A,B". In the browser, the truth is -// solidjs/solid#5146 +// solidjs/solid#5146 (FIXED in solid main fcaa05104, #5150) // written (rename "Y"). Rendered on an empty page: "Y,B". Hydrated from the server's page: does the view follow? import { harness, wait } from "../_hydrate.mjs"; const rows = [{ id: 1, t: "A" }, { id: 2, t: "B" }];