Skip to content

Commit a22b71a

Browse files
committed
R-8: recommend the region form; labels and chain references pass R-8
A bare disabled={pending? x} outside any loading region holds the page (here the detail) on x's first load and broke the desk's tests; the message and spec now lead with putting the control in a loading/errored region that reads x. The labels and chain references do that and pass visible, hidden and overlap suites (the known #4425 test aside). ref: crate 311/311, test/compiled/oracle 105/105, types 147. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWKEv4MghW8Ns9LeUUX
1 parent fdd175e commit a22b71a

8 files changed

Lines changed: 72 additions & 43 deletions

File tree

‎compiler/src/check.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3028,7 +3028,7 @@ impl<'a> Checker<'a> {
30283028
"UNGUARDED_SNAPSHOT",
30293029
"R-8",
30303030
format!(
3031-
"{} reads {} as a snapshot, and {} {}: the click then {} — cover the element (`disabled={{pending? {}}}`, or move it inside the `loading` / `errored` region that shows {}){}",
3031+
"{} reads {} as a snapshot, and {} {}: the click then {} — move the element inside a `loading` / `errored` region whose content reads {} (with `disabled={{pending? {}}}` for a new question){}",
30323032
what,
30333033
n,
30343034
n,

‎eval/reference/chain1/rx/labels.rx‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ export component Labels(props: { id: number }) {
5353
}}
5454
</div>
5555
<input data-testid="label-input" value={labelInput} onInput={e => { labelInput := e.target.value }} />
56-
<button data-testid="add-label" onClick={() => {
57-
if (labelInput != "" && !shown.includes(labelInput)) {
58-
let label = labelInput
59-
onFlush(() => { labelInput := "" })
60-
add(props.id, label)
61-
}
62-
}}>add label</button>
56+
{loading on(props.id) fallback { <button data-testid="add-label" disabled>add label</button> } {
57+
{errored fallback(e) { <button data-testid="add-label" disabled>add label</button> } {
58+
<button data-testid="add-label" disabled={pending? shown} onClick={() => {
59+
if (labelInput != "" && !shown.includes(labelInput)) {
60+
let label = labelInput
61+
onFlush(() => { labelInput := "" })
62+
add(props.id, label)
63+
}
64+
}}>add label</button>
65+
}}
66+
}}
6367
{if labelError != "" {
6468
<p>label error: {labelError}</p>
6569
}}

‎eval/reference/chain2/rx/labels.rx‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ export component Labels(props: { id: number }) {
5353
}}
5454
</div>
5555
<input data-testid="label-input" value={labelInput} onInput={e => { labelInput := e.target.value }} />
56-
<button data-testid="add-label" onClick={() => {
57-
if (labelInput != "" && !shown.includes(labelInput)) {
58-
let label = labelInput
59-
onFlush(() => { labelInput := "" })
60-
add(props.id, label)
61-
}
62-
}}>add label</button>
56+
{loading on(props.id) fallback { <button data-testid="add-label" disabled>add label</button> } {
57+
{errored fallback(e) { <button data-testid="add-label" disabled>add label</button> } {
58+
<button data-testid="add-label" disabled={pending? shown} onClick={() => {
59+
if (labelInput != "" && !shown.includes(labelInput)) {
60+
let label = labelInput
61+
onFlush(() => { labelInput := "" })
62+
add(props.id, label)
63+
}
64+
}}>add label</button>
65+
}}
66+
}}
6367
{if labelError != "" {
6468
<p>label error: {labelError}</p>
6569
}}

‎eval/reference/chain3/rx/labels.rx‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ export component Labels(props: { id: number }) {
5353
}}
5454
</div>
5555
<input data-testid="label-input" value={labelInput} onInput={e => { labelInput := e.target.value }} />
56-
<button data-testid="add-label" onClick={() => {
57-
if (labelInput != "" && !shown.includes(labelInput)) {
58-
let label = labelInput
59-
onFlush(() => { labelInput := "" })
60-
add(props.id, label)
61-
}
62-
}}>add label</button>
56+
{loading on(props.id) fallback { <button data-testid="add-label" disabled>add label</button> } {
57+
{errored fallback(e) { <button data-testid="add-label" disabled>add label</button> } {
58+
<button data-testid="add-label" disabled={pending? shown} onClick={() => {
59+
if (labelInput != "" && !shown.includes(labelInput)) {
60+
let label = labelInput
61+
onFlush(() => { labelInput := "" })
62+
add(props.id, label)
63+
}
64+
}}>add label</button>
65+
}}
66+
}}
6367
{if labelError != "" {
6468
<p>label error: {labelError}</p>
6569
}}

‎eval/reference/chain4/rx/labels.rx‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ export component Labels(props: { id: number }) {
5353
}}
5454
</div>
5555
<input data-testid="label-input" value={labelInput} onInput={e => { labelInput := e.target.value }} />
56-
<button data-testid="add-label" onClick={() => {
57-
if (labelInput != "" && !shown.includes(labelInput)) {
58-
let label = labelInput
59-
onFlush(() => { labelInput := "" })
60-
add(props.id, label)
61-
}
62-
}}>add label</button>
56+
{loading on(props.id) fallback { <button data-testid="add-label" disabled>add label</button> } {
57+
{errored fallback(e) { <button data-testid="add-label" disabled>add label</button> } {
58+
<button data-testid="add-label" disabled={pending? shown} onClick={() => {
59+
if (labelInput != "" && !shown.includes(labelInput)) {
60+
let label = labelInput
61+
onFlush(() => { labelInput := "" })
62+
add(props.id, label)
63+
}
64+
}}>add label</button>
65+
}}
66+
}}
6367
{if labelError != "" {
6468
<p>label error: {labelError}</p>
6569
}}

‎eval/reference/labels/rx/labels.rx‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,17 @@ export component Labels(props: { id: number }) {
5353
}}
5454
</div>
5555
<input data-testid="label-input" value={labelInput} onInput={e => { labelInput := e.target.value }} />
56-
<button data-testid="add-label" onClick={() => {
57-
if (labelInput != "" && !shown.includes(labelInput)) {
58-
let label = labelInput
59-
onFlush(() => { labelInput := "" })
60-
add(props.id, label)
61-
}
62-
}}>add label</button>
56+
{loading on(props.id) fallback { <button data-testid="add-label" disabled>add label</button> } {
57+
{errored fallback(e) { <button data-testid="add-label" disabled>add label</button> } {
58+
<button data-testid="add-label" disabled={pending? shown} onClick={() => {
59+
if (labelInput != "" && !shown.includes(labelInput)) {
60+
let label = labelInput
61+
onFlush(() => { labelInput := "" })
62+
add(props.id, label)
63+
}
64+
}}>add label</button>
65+
}}
66+
}}
6367
{if labelError != "" {
6468
<p>label error: {labelError}</p>
6569
}}

‎eval/results/fuzz-2026-10-30/README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ What each one is:
7272
(`snapshot(...).some is not a function`). After a failed load it throws the load's error out of the click. New rule
7373
R-8 (`spec/04-rows.md`, taken by default, 064513d) makes this a compile error, `UNGUARDED_SNAPSHOT`. On the eval
7474
apps it fires on exactly these 36 apps and the labels and chain references, and on nothing else.
75-
`disabled={pending? shown}` plus a `catch` on the read clears it. With that fix labels-rx-1 drops from 11 seeds
76-
with a hole to 5, and none of the 5 is a page error.
75+
`disabled={pending? shown}` plus a `catch` on the read passes the check. With that fix labels-rx-1 drops from 11
76+
seeds with a hole to 5, and none of the 5 is a page error. But a bare `disabled` outside any region holds the
77+
detail on the labels' first load, and that breaks the desk's tests. The labels and chain references now put the
78+
button in its own `loading on(id)` and `errored` region, with `disabled={pending? shown}`, and pass every suite
79+
(#4425 aside, as before).
7780
- **never settles, 47:** a failed load of the selected issue leaves `loading #n` up for good. The detail's source
7881
`found(await fetchIssue(selected), selected)` hoists its `await` into a memo, which the optimistic store reads, and
7982
solid#4437 swallows the error.

‎spec/04-rows.md‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ and where they may not go.
105105
R-12); for the failure half, the read is inside a `try` or a `catch`
106106
expression that takes its failures (`x.some(…) catch (e) => false`,
107107
R-f-7). In an action, R-f-6 already requires the second;
108-
- covered: the handler is on an element whose `disabled` reads `x` (the
109-
usual form is `disabled={pending? x}`), or the element sits inside a
110-
`loading` and an `errored` region whose content reads `x`. A covered
108+
- covered: the element sits inside a `loading` and an `errored` region
109+
whose content reads `x` (the usual form: the control lives in the region
110+
that shows `x`, with `disabled={pending? x}` for a new question), or the
111+
handler is on an element whose `disabled` reads `x`. The second form
112+
holds on `x`'s first load like any reader: with no `loading` above it,
113+
that is the page (H-5), so it fits an `x` that already has a value. A covered
111114
element is not there, or not enabled, while `x` has no value, a new
112115
question out, or an error, so the handler never runs then: the element's
113116
attributes are the handler's compute half, with the same separated
@@ -131,8 +134,11 @@ and where they may not go.
131134
click. Frames: `loading labels | [add]`, then a run-time `TypeError` (no
132135
value). With `reject labels e` before the click: `labels error | [add]`,
133136
then the click throws `e`. Both are `UNGUARDED_SNAPSHOT` at compile time.
134-
Fixes: `disabled={pending? shown}` plus the read under `catch`, or the
135-
button moved inside the region. Not yet checked by `rxc` or `ref/`.
137+
Fix (the eval references): the button inside a `loading on(id)` and an
138+
`errored` region of its own, with `disabled={pending? shown}`. A bare
139+
`disabled={pending? shown}` on the button outside any region also passes
140+
the check, but holds the detail on the labels' first load (the eval's tests
141+
then fail). Checked by `rxc` (`UNGUARDED_SNAPSHOT`), not yet by `ref/`.
136142

137143
## R-lane — display-ahead
138144

0 commit comments

Comments
 (0)