Skip to content

Commit 8395412

Browse files
committed
Repin Solid to 2.0.0-rc.22: keyed answers returned for Solid to reconcile; DV-19/20/23 fixed (#64)
- ref/SOLID_NEXT -> rc.22 (221b5f9); runtime and eval deps ^2.0.0-rc.22 - landDraft returns a keyed answer from the derive (Solid reconciles by key at any depth, ST-4a); unkeyed answers still assigned. Drops the hand-written keyed merge from #63. - S-guess-reask-refresh, S-latest-reask, S-solid-46: divergence records removed (fixed in rc.22) - S-solid-44: only DV-22 (pending? under a new question) still recorded, instant 3 - All ref runners green: oracle/compiled 131/131, ssr 124 (7 skip), types 177, crate 367/367 Closes #64 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWLtkg281f1NkGEDjCt
1 parent 6146c67 commit 8395412

15 files changed

Lines changed: 167 additions & 199 deletions

‎eval/package-lock.json‎

Lines changed: 97 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎eval/package.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"description": "The .rx vs React (and Solid 2 TSX) benchmark harness (eval/README.md)",
66
"dependencies": {
77
"@effect/platform-browser": "^4.1.0",
8-
"@solidjs/compiler": "2.0.0-rc.21",
9-
"@solidjs/signals": "2.0.0-rc.21",
10-
"@solidjs/web": "2.0.0-rc.21",
8+
"@solidjs/compiler": "2.0.0-rc.22",
9+
"@solidjs/signals": "2.0.0-rc.22",
10+
"@solidjs/web": "2.0.0-rc.22",
1111
"@tanstack/react-query": "5.90.2",
1212
"@types/react": "19.2.2",
1313
"@types/react-dom": "19.2.1",
@@ -21,7 +21,7 @@
2121
"playwright": "1.64.1",
2222
"react": "19.2.0",
2323
"react-dom": "19.2.0",
24-
"solid-js": "2.0.0-rc.21",
24+
"solid-js": "2.0.0-rc.22",
2525
"typescript": "5.9.3",
2626
"typescript-eslint": "8.46.0",
2727
"vite": "7.1.9",

‎ref/SOLID_NEXT‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2105ffb8ca2fced55f5fac0763177fc93f97c2c2
1+
221b5f99faf0f47dbe6d5c4c6cb77661053e44b8

‎ref/compile/rt-server.ts‎

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export function createApp(opts: { api?: Record<string, (...a: any[]) => unknown>
140140
},
141141
question(name: string, compute: (prev: unknown) => unknown, o: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean; derived?: boolean; record?: boolean }, key?: string): [Acc, Writer] {
142142
const fn = named(name, compute);
143-
if (mode.optimistic && mode.structured) { const [store] = (createOptimisticStore as any)((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))(); landDraft(draft, r, key); }, key && !mode.record ? [] : {}, key ? { key } : undefined); return ro(() => store); }
143+
if (mode.optimistic && mode.structured) { const [store] = (createOptimisticStore as any)((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); }, key && !mode.record ? [] : {}, key ? { key } : undefined); return ro(() => store); }
144144
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
145145
if (mode.optimistic) { const [truth] = createSignal(fn as any, o as any); const [get] = createOptimistic(() => (truth as Acc)()); return ro(get as Acc); }
146146
if (mode.structured) {
@@ -245,27 +245,13 @@ export function createApp(opts: { api?: Record<string, (...a: any[]) => unknown>
245245
}
246246
export type ServerApp = ReturnType<typeof createApp>;
247247

248-
/** A keyed answer is merged into the draft by key: a row whose key is still there keeps its object and takes the new
249-
* leaves, so an equal answer changes nothing and a changed one changes only its leaves (#51). Any other answer is
250-
* assigned.
251-
* TODO(Solid rc.22): return the keyed answer from the derive and let Solid reconcile it, dropping this merge. On
252-
* 2.0.0-rc.21 that path throws in holdStaging (memo over latest() of the rows); fixed on Solid next (dba2aad). */
253-
const isRecord = (x: unknown): x is Record<string, unknown> => !!x && typeof x === "object" && !Array.isArray(x);
254-
function landDraft(draft: any, v: unknown, key: string | undefined) {
255-
// ST-4a: the key applies at any depth, as Solid's: lists under a record land by key too
256-
if (key && isRecord(v) && isRecord(draft)) {
257-
for (const k of Object.keys(draft)) if (!(k in v)) delete draft[k];
258-
for (const [k, x] of Object.entries(v)) { const d = draft[k]; if (x && typeof x === "object" && d && typeof d === "object" && Array.isArray(x) === Array.isArray(d)) landDraft(d, x, key); else if (d !== x) draft[k] = x; }
259-
return;
260-
}
261-
if (!key || !Array.isArray(v) || !Array.isArray(draft)) return assignDraft(draft, v);
262-
const had = new Map<unknown, any>(); for (const row of draft) if (row && typeof row === "object") had.set(row[key], row);
263-
v.forEach((x: any, i) => { const row = x && typeof x === "object" ? had.get(x[key]) : undefined; if (row) { mergeLeaves(row, x); if (draft[i] !== row) draft[i] = row; } else draft[i] = x; });
264-
draft.length = v.length;
265-
}
266-
function mergeLeaves(o: any, v: any) {
267-
for (const k of Object.keys(o)) if (!(k in v)) delete o[k];
268-
for (const k of Object.keys(v)) { const a = o[k], b = v[k]; if (a && b && typeof a === "object" && typeof b === "object" && Array.isArray(a) === Array.isArray(b)) { if (Array.isArray(a)) { a.length = b.length; } mergeLeaves(a, b); } else if (a !== b) o[k] = b; }
248+
/** A keyed answer is returned from the derive, and Solid reconciles it by key at any depth (ST-4a): a row whose key is
249+
* still there keeps its object and takes the new leaves, so an equal answer changes nothing (#51, #64). Any other
250+
* answer is assigned to the draft. */
251+
function landDraft(draft: any, v: unknown, key: string | undefined): unknown {
252+
if (key && v && typeof v === "object") return v;
253+
assignDraft(draft, v);
254+
return undefined;
269255
}
270256
/** A store draft becomes `v`: keys `v` lacks are removed, the rest assigned (an array's length follows). */
271257
function assignDraft(draft: any, v: unknown) {

0 commit comments

Comments
 (0)