[2.0 RC20] Development attribution can trigger context errors by evaluating lazy children getters
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- devtools
Direzione di ricerca
The comparator is shallowEquivalent in packages/signals/src/core/attribution.ts, which reads property values directly and so invokes getters on both previous and next output; it is shared by UNSTABLE_MEMO_OUTPUT and UNSTABLE_LIST_IDENTITY. Start by running the minimal repro with node --conditions=development repro.mjs and confirm it prints 2 when attribution is enabled. Done when the repro prints 0 and the comparator no longer evaluates lazy getters.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happened?
While porting a base ui to Solid 2, I encountered context errors in development previews for simple components. Their component tests were passing, which initially made this look like a problem with the preview setup or our Solid adaptations.
After reducing the failing case, I found that attribution’s output comparison was evaluating a lazy children getter that the application had not read. When that getter constructs JSX or reads context, the diagnostic can run it outside the expected owner and cause a context error.
I originally encountered this on RC13 and confirmed that the underlying behavior still reproduces with the unpatched RC20 package. The reproduction below requires neither our component library nor JSX.
Minimal reproduction
Install @solidjs/[email protected], save this as repro.mjs, and run node --conditions=development repro.mjs:
import {
createEffect,
createMemo,
createRoot,
createSignal,
flush
} from "@solidjs/signals";
import { attribution } from "@solidjs/signals/attribution";
let reads = 0;
let update;
attribution.enable({ log: false });
const dispose = createRoot(dispose => {
const [version, setVersion] = createSignal(0);
update = () => setVersion(v => v + 1);
const record = createMemo(() => {
version();
return {
get children() {
reads++;
return "child";
}
};
});
createEffect(record, () => {});
return dispose;
});
try {
flush();
update();
flush();
console.log(reads);
} finally {
attribution.disable();
dispose();
}
Expected behavior
reads remains 0: neither the application nor the effect reads children. Enabling development diagnostics should not introduce execution of that lazy getter.
Actual behavior
The example prints 2. Without attribution enabled, it prints 0.
The counting getter demonstrates the unexpected execution without throwing. In the original component previews, the getter performs context-dependent work, so that extra execution can interrupt rendering with an ownership or missing-context error.
Investigation
shallowEquivalent in packages/signals/src/core/attribution.ts compares property values directly. This invokes getters on both the previous and next output. Array-index getters are affected too.
The comparator is shared by UNSTABLE_MEMO_OUTPUT and UNSTABLE_LIST_IDENTITY.
- Lingua principale
- TypeScript
- Stelle
- 36.2k
- Fork
- 1.1k
- Merge medio
- 10h 39m
- PR unite (30g)
- 500
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di solidjs/solid
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
[2.0 / next] Optimistic todo list with an "N left" memo loops forever when a toggle's save landsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
-
[2.0 / next] createOptimisticStore: add, delete, add with saves pending hands <For> an undefined rowAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di solidjs/solid
Issue simili
-
area: frontend priority: normal
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
formbricks/formbricks#9918 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
thecodacus/pithagoras#364 ·
I maintainer di solito rispondono entro 1 giorno
-
TestAutonomousStop_ReportsObservedState fails under host load: 1s wall-clock ceiling vs 250ms cycleApertatype:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nightgauge/nightgauge#2909 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno