Skip to content

Commit 0140638

Browse files
ryansolidclaude
andauthored
Allow a guess over an equation (Solid's createOptimistic(fn)) (#48)
* Rename the `optimistic` statement to `guess` `guess x := e` replaces `optimistic x := e` (07 decision 18, ruled 2026-11-11). Semantics and lowering are unchanged (createOptimistic / createOptimisticStore); only the surface word moves. - Parsers (ref/src/parse.ts, compiler/src/parse.rs): `guess` is the keyword; `optimistic` stays reserved and is a parse error coded OPTIMISTIC whose hint names `guess` (guide/diagnostics.md, S-parse-hints). - Codes: OPTIMISTIC_OUTSIDE_HOLD -> GUESS_OUTSIDE_HOLD, OPTIMISTIC_NO_QUESTION -> GUESS_NO_QUESTION, OPTIMISTIC_REVERTED -> GUESS_REVERTED; HELD_WRITE / STALE_WRITE_BACK / AC-1b messages say `guess`. - Spec, guide, scenarios, examples, eval reference apps and the editor grammar use `guess`. eval/results and preregistrations are left as historical records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH * Don't reserve `optimistic`: it names Solid's primitive, not a keyword Drops the OPTIMISTIC parse hint, its guide section, spec row and S-parse-hints variant; 07 decision 18 says why. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH * Clear errors with onFlush, not a guess An error clear is a reset that lands now (EF-8), not a guess at the server's answer: `guess saveError := ""` worked only because the source was given a constant question to revert to. The guide's action example, the examples and the eval reference apps now write `onFlush(() => { saveError := "" })`, and those error sources are declared with `:=`. S-ai2-settings gains the flush instant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH * Allow a guess over an equation (Solid's createOptimistic(fn)) `x = e` then `guess x := v` in an action is legal (06 ST-5c, 07 decision 19): a guess is not a write of the truth, and Solid's derived createOptimistic(fn) has a setter that only guesses. A plain `x := v` on an equation stays WRITE_TO_NON_SOURCE; `props.x` and parameters stay refused (O-4). New code GUESS_ON_DEFERRED: a deferred equation lags its truth (V-16). Lowering: a guessed equation is createOptimistic(fn), or createOptimisticStore(fn, seed) when keyed or guessed by path, on the client, the server (matching owner trees for hydration) and in the oracle. Both checkers and both emitters agree (crate parity, lowered alike). Scenario S-guess-equation covers an equation of a source and a child's equation of a prop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH * Scenario: a guess by path over a keyed equation (createOptimisticStore(fn, seed)) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c9177e3 commit 0140638

17 files changed

Lines changed: 282 additions & 17 deletions

‎compiler/src/check.rs‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ struct Sym<'a> {
221221
/// O-3: not a name but a prop's argument, stored — its captures are the caller's ("*": all of props)
222222
prop_of: Option<(RId, String)>,
223223
maps_records: bool,
224+
/// a declared equation, and whether it is deferred: a guess may sit over one that is not (AC-3, ST-5c)
225+
eq_decl: Option<bool>,
224226
rows: Option<RowsT<'a>>,
225227
comp: Option<&'a Decl>,
226228
expr: Option<(&'a Expr, EId)>,
@@ -253,6 +255,7 @@ impl<'a> Sym<'a> {
253255
ret_captures: None,
254256
prop_of: None,
255257
maps_records: false,
258+
eq_decl: None,
256259
rows: None,
257260
comp: None,
258261
expr: None,
@@ -1166,7 +1169,8 @@ impl<'a> Checker<'a> {
11661169
let r = self.region(Some(region), "component", true, Some(name.clone()));
11671170
sym.comp_region = Some(r);
11681171
}
1169-
Decl::Eq { e, key, .. } => {
1172+
Decl::Eq { e, key, deferred, .. } => {
1173+
sym.eq_decl = Some(*deferred);
11701174
sym.maps_records = key.is_none() && maps_into_records(e);
11711175
if let ExprKind::Id(n) = &e.k {
11721176
if let Some(t) = self.lookup(env, n) {
@@ -2332,7 +2336,16 @@ impl<'a> Checker<'a> {
23322336
self.model.write(tsym, op, !target.path.is_empty());
23332337
if let Some(t) = tsym {
23342338
let k = self.syms[t].kind;
2335-
if k != SymKind::Source {
2339+
// AC-3: a guess may sit over an equation (Solid's createOptimistic(fn)); it is not a write of the truth
2340+
let guessable = op == "optimistic" && k == SymKind::Eq && self.syms[t].eq_decl.is_some() && !self.syms[t].param && self.syms[t].imported.is_none();
2341+
if guessable && self.syms[t].eq_decl == Some(true) {
2342+
self.err(
2343+
"GUESS_ON_DEFERRED",
2344+
"AC-3",
2345+
format!("{} is deferred: its value is a lagging copy (V-16), so nothing would confirm a guess on it — guess the equation it lags", target.name),
2346+
);
2347+
} else if guessable {
2348+
} else if k != SymKind::Source {
23362349
let what = match k {
23372350
SymKind::Eq => "an equation".to_string(),
23382351
SymKind::Props => "props".to_string(),

‎compiler/src/emit.rs‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,11 @@ impl<'p> Gen<'p> {
626626
}
627627
// SF-1d: a server fn, not an accessor
628628
Decl::Eq { name, e, .. } if unwrap_server(e).is_some() => self.set(env, name, val(mg(name))),
629-
Decl::Eq { name, .. } => {
629+
Decl::Eq { name, e, deferred, .. } => {
630630
let mut b = bind(Kind::Acc, mg(name));
631+
if self.guessed_eq(name, e, *deferred) {
632+
b.w = Some(format!("w${name}"));
633+
}
631634
b.prev = self.u.prev_of.contains(name).then(|| format!("p${name}"));
632635
self.set(env, name, b);
633636
}
@@ -952,6 +955,19 @@ impl<'p> Gen<'p> {
952955
prev(&mut out);
953956
Ok(out)
954957
}
958+
Decl::Eq { name, e, key, deferred, .. } if self.guessed_eq(name, e, *deferred) => {
959+
// AC-3 over an equation: createOptimistic(fn) / createOptimisticStore(fn, seed) — derived, its setter only guesses
960+
let lv = self.loading_value(e, env)?;
961+
let mode = obj(vec![("optimistic", E::Bool(true)), ("structured", E::Bool(self.u.paths.contains(name) || key.is_some())), ("derived", E::Bool(true))]);
962+
let x = self.expr(e, env, &Ctx { tail: true, self_: Some(name.clone()), ..Ctx::default() })?;
963+
let mut args = vec![str(name.clone()), arrow(&["__prev"], x), lv, mode];
964+
if let Some(k) = key {
965+
args.push(str(k.clone()));
966+
}
967+
let mut out = vec![S::Const(pair(), rtc("question", args)), self.reg(name, b, true)];
968+
prev(&mut out);
969+
Ok(out)
970+
}
955971
Decl::Eq { name, e, key, deferred, .. } => {
956972
let fin = |mut out: Vec<S>, g: &Self| {
957973
out.push(g.reg(name, b, false));
@@ -1516,6 +1532,10 @@ impl<'p> Gen<'p> {
15161532
Ok(out)
15171533
}
15181534
/// A region's body as a child: its declarations, then its view (a function body, so it is owned where it is called).
1535+
/// An equation a guess sits over (AC-3): not deferred, not a draft, not a wrapped server fn.
1536+
fn guessed_eq(&self, name: &str, e: &Expr, deferred: bool) -> bool {
1537+
self.u.optimistic.contains(name) && !deferred && !matches!(&e.k, ExprKind::Draft { .. }) && unwrap_server(e).is_none()
1538+
}
15191539
fn region_fn(&mut self, decls: &[Decl], view: &[Markup], env: Env, param: Option<String>, narrow: Option<(String, Bind)>, bind_name: Option<String>) -> R<E> {
15201540
let inner = self.new_env(Some(env));
15211541
let mut pre = vec![];

‎guide/async.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ by what the screen should do:
8585

8686
| You want | Write |
8787
| --- | --- |
88-
| Show a value now, and take it back if the action fails | `guess x := v` (x is a source with a question: `source x = …`) |
88+
| Show a value now, and take it back if the action fails | `guess x := v` (x is an equation, `x = …`, or a source with a question, `source x = …`) |
8989
| `pending? x` true while the action runs | `affects x` |
9090
| Land a UI write now and keep it (close a menu, clear a message) | `onFlush(() => { x := v })` (EF-8) |
9191
| Record the server's answer | `x := answer` after the `await` |

‎guide/diagnostics.md‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,9 @@ export default component App() {
462462

463463
### GUESS_NO_QUESTION
464464

465-
A guess is confirmed or replaced by the answer to a question, so `guess` writes a source declared with `=` (a
466-
source with a question, ST-5c). A source seeded with `:=` has no question; write it plainly.
465+
A guess is confirmed or replaced by the answer to a question, so `guess` writes an equation or a source declared
466+
with `=` (a source with a question, ST-5c). A source seeded with `:=` has no question; write it plainly, or with
467+
`onFlush` if it is a reset that should land now (EF-8).
467468

468469
```rx before
469470
export default component App() {
@@ -481,6 +482,31 @@ export default component App() {
481482
}
482483
```
483484

485+
### GUESS_ON_DEFERRED
486+
487+
A `deferred` equation is a lagging copy of another value (V-16), so nothing would confirm a guess on it. Guess the
488+
value it lags.
489+
490+
```rx before
491+
export default component App() {
492+
source name := "Ann"
493+
shown = name
494+
deferred later = shown
495+
action fix() { guess later := "Zed"; await fetch("x") catch (e) => null }
496+
<button onClick={() => { fix() }}>{later}</button>
497+
}
498+
```
499+
500+
```rx after
501+
export default component App() {
502+
source name := "Ann"
503+
shown = name
504+
deferred later = shown
505+
action fix() { guess shown := "Zed"; await fetch("x") catch (e) => null }
506+
<button onClick={() => { fix() }}>{later}</button>
507+
}
508+
```
509+
484510
### INVALID_REFRESH_TARGET
485511

486512
`refresh x` re-asks `x`'s question (AC-4), so `x` is an equation that awaits or a source declared with `=`. A source

‎guide/reference.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Expr ::= TypeScript's, without assignment, `this`, `function`, `new` on rea
5858
- A failure inside the body must be caught there: `try { … } catch (e) { … }` (R-f-6, AC-7). The catch runs inside the
5959
same change: its writes land with the body's end. A rejected body commits its plain writes and reverts its guesses
6060
(AC-1, DV-2).
61-
- `guess x := e`: a guess on a source with a question (`source x = …`), shown now, kept until the action's change
61+
- `guess x := e`: a guess on an equation (`x = …`) or a source with a question (`source x = …`), shown now, kept until the action's change
6262
commits or `x`'s own answer differs (AC-3, H-11). Guesses on one source hold together.
6363
- `refresh x`: asks `x` again, quietly (no `pending?`; the old value stays up until the new one lands). Inside an
6464
action, the answer lands with the action's commit (AC-4).

‎ref/compile/emit.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ class Gen {
241241
if (d.k === "error" || d.k === "context") env.vars.set(d.name, { kind: "val", js: mg(d.name) });
242242
if (d.k === "source") env.vars.set(d.name, { kind: "src", js: mg(d.name), w: `w$${d.name}`, prev: this.u.prevOf.has(d.name) ? `p$${d.name}` : undefined });
243243
if (d.k === "eq" && unwrapServer(d.e)) { env.vars.set(d.name, { kind: "val", js: mg(d.name) }); continue; } // SF-1d: a server fn, not an accessor
244-
if (d.k === "eq") env.vars.set(d.name, { kind: d.e.k === "call" && d.e.f.k === "id" && env.lookup(d.e.f.name)?.kind === "ifn" ? "acc" : "acc", js: mg(d.name), prev: this.u.prevOf.has(d.name) ? `p$${d.name}` : undefined });
244+
if (d.k === "eq") env.vars.set(d.name, { kind: d.e.k === "call" && d.e.f.k === "id" && env.lookup(d.e.f.name)?.kind === "ifn" ? "acc" : "acc", js: mg(d.name), w: this.guessedEq(d) ? `w$${d.name}` : undefined, prev: this.u.prevOf.has(d.name) ? `p$${d.name}` : undefined });
245245
}
246246
for (const d of decls) if (d.k === "import" && !d.resolved) for (const { name, alias } of d.names) {
247247
const v = !d.from.startsWith(".") && !BUILTINS.has(name) && name !== "log" ? `w$${alias}` : name === "log" ? "__B.log" : d.declaredErrors?.includes(name) ? `__rt.jsError(${J(name)})` : BUILTINS.has(name) ? `__B.${name}` : d.from.endsWith("/api") ? `__rt.api(${J(name)})` : null;
@@ -313,6 +313,8 @@ class Gen {
313313
}).join("\n");
314314
}
315315
private hoistAll(es: Expr[], env: Env, pad: string): string[] { return es.map(x => this.hoist(null, x, env, pad, false)).filter(Boolean); }
316+
/** An equation a guess sits over (AC-3): not deferred, not a draft, not a wrapped server fn. */
317+
private guessedEq(d: Extract<Decl, { k: "eq" }>): boolean { return this.u.optimistic.has(d.name) && !d.deferred && d.e.k !== "draft" && !unwrapServer(d.e); }
316318
private value1(d: Decl, env: Env, ind: number, b: Bind): string {
317319
const pad = " ".repeat(ind * 2);
318320
const prev = b.prev ? `\n${pad}const ${b.prev} = __rt.pre(${b.js});` : "";
@@ -323,6 +325,11 @@ class Gen {
323325
return `${pad}const [${b.js}, ${b.w}] = __rt.question(${J(d.name)}, (__prev) => ${this.expr(d.init, env, { imp: false, tail: true, self: d.name })}, ${lv}, ${mode}${d.key ? `, ${J(d.key)}` : ""});\n${pad}__rt.reg(${J(d.name)}, { get: ${b.js}, w: ${b.w} });${prev}`;
324326
}
325327
if (d.k !== "eq") throw new CompileError("unreachable");
328+
if (this.guessedEq(d)) { // AC-3 over an equation: createOptimistic(fn) / createOptimisticStore(fn, seed) — derived, its setter only guesses
329+
const lv = this.loadingValue(d.e, env);
330+
const mode = `{ optimistic: true, structured: ${this.u.paths.has(d.name) || !!d.key}, derived: true }`;
331+
return `${pad}const [${b.js}, ${b.w}] = __rt.question(${J(d.name)}, (__prev) => ${this.expr(d.e, env, { imp: false, tail: true, self: d.name })}, ${lv}, ${mode}${d.key ? `, ${J(d.key)}` : ""});\n${pad}__rt.reg(${J(d.name)}, { get: ${b.js}, w: ${b.w} });${prev}`;
332+
}
326333
const reg = `\n${pad}__rt.reg(${J(d.name)}, { get: ${b.js} });${prev}`;
327334
if (d.e.k === "draft") { // ST-3
328335
const seed = d.e.seed; if (seed.k !== "pre" || seed.name !== d.name || !seed.init) throw new CompileError("a draft's seed must be `pre self -> seed`");

‎ref/compile/rt-server.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ export function createApp(opts: { api?: Record<string, (...a: any[]) => unknown>
131131
if (typeof init === "object" && init !== null) { const [store] = createStore(init as any); const [get] = createSignal<unknown>(store); return ro(get as Acc); }
132132
const [get] = createSignal(init); return ro(get as Acc);
133133
},
134-
question(name: string, compute: (prev: unknown) => unknown, o: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean }, key?: string): [Acc, Writer] {
134+
question(name: string, compute: (prev: unknown) => unknown, o: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean; derived?: boolean }, key?: string): [Acc, Writer] {
135135
const fn = named(name, compute);
136136
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 () => assignDraft(draft, r instanceof Flight ? await r.first : await r))(); assignDraft(draft, r); }, key ? [] : {}, key ? { key } : undefined); return ro(() => store); }
137+
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
137138
if (mode.optimistic) { const [truth] = createSignal(fn as any, o as any); const [get] = createOptimistic(() => (truth as Acc)()); return ro(get as Acc); }
138139
if (mode.structured) {
139140
const [store] = (createStore as any)(async (draft: Record<string, unknown>) => { const r = fn(draft); const v = r instanceof Flight ? await r.first : await r; if (v && typeof v === "object") { for (const k of Object.keys(draft)) if (!(k in (v as object))) delete draft[k]; Object.assign(draft, v); } }, {});

‎ref/compile/rt-web.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,19 @@ export function createApp(opts: { root: any; api?: Record<string, (...a: any[])
171171
},
172172
/** `source x = e` (ST-5): createSignal(fn); with a guess written to it, a createOptimistic layer over that truth (AC-3);
173173
* written or probed by path, createStore(fn, {}) whose derive writes its draft. */
174-
question(name: string, compute: (prev: unknown) => unknown, opts: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean }, key?: string): [Acc, Writer] {
174+
question(name: string, compute: (prev: unknown) => unknown, opts: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean; derived?: boolean }, key?: string): [Acc, Writer] {
175175
const fn = named(name, compute);
176176
if (mode.optimistic && mode.structured) { // AC-3 path targets: createOptimisticStore(fn, seed) — the derive writes its draft; the setter guesses per key
177177
const [store, setStore] = (createOptimisticStore as any)((draft: any) => { const r = fn(draft); if (r instanceof Flight || r instanceof Promise) return (async () => assignDraft(draft, r instanceof Flight ? await r.first : await r))(); assignDraft(draft, r); }, key ? [] : {}, key ? { key } : undefined);
178178
const get = () => store; storeAccs.add(get);
179179
const plain = () => { throw new Error("a plain write to an optimistic store is not lowered yet"); };
180180
return [get, { set: plain, path: plain, guess: (v, keys = []) => setStore((d: any) => { if (keys.length === 0) return typeof v === "function" ? (v as (x: unknown) => unknown)(d) : v; /* a whole guess is the setter\'s return, which Solid diffs shallowly against the view as guesses */ let o = d; for (const k of keys.slice(0, -1)) o = o[k]; const last = keys[keys.length - 1]; o[last] = typeof v === "function" ? (v as (x: unknown) => unknown)(o[last]) : v; }) }];
181181
}
182+
if (mode.optimistic && mode.derived) { // AC-3 over an equation: createOptimistic(fn), whose setter only guesses
183+
const plain = () => { throw new Error("a plain write to an equation"); };
184+
const [get, setGuess] = createOptimistic(fn as any, opts as any);
185+
return [get as Acc, { set: plain, path: plain, guess: setGuess as any }];
186+
}
182187
if (mode.optimistic) {
183188
const [truth, setTruth] = createSignal(fn as any, opts as any);
184189
const [get, setGuess] = createOptimistic(() => truth());

‎ref/compile/rt.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,19 @@ export function createApp(opts: { api?: Record<string, (...a: any[]) => unknown>
181181
},
182182
/** `source x = e` (ST-5): createSignal(fn); with a guess written to it, a createOptimistic layer over that truth (AC-3);
183183
* written or probed by path, createStore(fn, {}) whose derive writes its draft. */
184-
question(name: string, compute: (prev: unknown) => unknown, opts: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean }, key?: string): [Acc, Writer] {
184+
question(name: string, compute: (prev: unknown) => unknown, opts: { loadingValue?: unknown } | undefined, mode: { optimistic: boolean; structured: boolean; derived?: boolean }, key?: string): [Acc, Writer] {
185185
const fn = named(name, compute);
186186
if (mode.optimistic && mode.structured) { // AC-3 path targets: createOptimisticStore(fn, seed) — the derive writes its draft; the setter guesses per key
187187
const [store, setStore] = (createOptimisticStore as any)((draft: any) => { const r = fn(draft); if (r instanceof Flight || r instanceof Promise) return (async () => assignDraft(draft, r instanceof Flight ? await r.first : await r))(); assignDraft(draft, r); }, key ? [] : {}, key ? { key } : undefined);
188188
const get = () => store; storeAccs.add(get);
189189
const plain = () => { throw new Error("a plain write to an optimistic store is not lowered yet"); };
190190
return [get, { set: plain, path: plain, guess: (v, keys = []) => setStore((d: any) => { if (keys.length === 0) return typeof v === "function" ? (v as (x: unknown) => unknown)(d) : v; /* a whole guess is the setter\'s return, which Solid diffs shallowly against the view as guesses */ let o = d; for (const k of keys.slice(0, -1)) o = o[k]; const last = keys[keys.length - 1]; o[last] = typeof v === "function" ? (v as (x: unknown) => unknown)(o[last]) : v; }) }];
191191
}
192+
if (mode.optimistic && mode.derived) { // AC-3 over an equation: createOptimistic(fn), whose setter only guesses
193+
const plain = () => { throw new Error("a plain write to an equation"); };
194+
const [get, setGuess] = createOptimistic(fn as any, opts as any);
195+
return [get as Acc, { set: plain, path: plain, guess: setGuess as any }];
196+
}
192197
if (mode.optimistic) {
193198
const [truth, setTruth] = createSignal(fn as any, opts as any);
194199
const [get, setGuess] = createOptimistic(() => truth());

‎ref/oracle/lower.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,19 @@ export class Oracle {
282282
scope.vars.set(d.name, { k: "memo", get: () => proj });
283283
break;
284284
}
285+
if (this.optimisticTargets.has(d.name) && !d.deferred) { // AC-3 over an equation: Solid's createOptimistic(fn) / createOptimisticStore(fn, seed) — derived, its setter only guesses
286+
const compute = this.computeOf(d.name, d.e, scope);
287+
const plain = () => { throw new Unsupported("a plain write to an equation"); };
288+
if (this.pathTargets.has(d.name) || d.key) {
289+
const derive = async (draft: any) => { const r = compute(draft); const v = r instanceof Flight ? await r.first : await r; assignDraft(draft, v); };
290+
const [store, setStore] = (createOptimisticStore as any)(derive, d.key ? [] : {}, d.key ? { key: d.key } : undefined);
291+
scope.vars.set(d.name, { k: "store", get: () => store, set: plain, setPath: plain, question: true, setGuess: setStore });
292+
} else {
293+
const [get, setGuess] = createOptimistic(compute as any, this.loadingValue(d.e, scope) as any);
294+
scope.vars.set(d.name, { k: "sig", get, set: plain as any, setGuess: setGuess as any, question: true, optimistic: true });
295+
}
296+
break;
297+
}
285298
if (d.key) { // ST-4: a keyed projection
286299
const compute = this.computeOf(d.name, d.e, scope);
287300
const src = createMemo(() => compute(undefined) as any, this.loadingValue(d.e, scope) as any); // the answer (sync, or the tail await's) is a memo; the projection reconciles it by key (found by S-ai2-search)

0 commit comments

Comments
 (0)