`store.users.push(x)` in a handler compiles with no diagnostic, and the write is lost
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
Direzione di ricerca
Start by running analyze on the program in the issue, which reports nothing, and by reading the lowered handler __rt.snapshot(v$store)?.users?.push(2). Find where the checker walks handler bodies and inspect member calls whose receiver is a source path, then check the list of mutating methods against decision 20 in 07. Done when analyze emits a diagnostic that points to the := form for push and the other listed methods, and the existing checker tests still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Calling a mutating method on a source's value in a handler, such as store.users.push(2), compiles with no diagnostic, and the write never happens. 07 decision 20 says "only := and guess mutate", so this should be a diagnostic that points to the := form, for example store.users := [...store.users, 2].
Program
export default component App() {
source store := { users: [1] }
<main>
<button onClick={() => { store.users.push(2) }}>add</button>
<p>{len(store.users)}</p>
</main>
}
analyze reports no diagnostics. The handler lowers to:
__rt.snapshot(v$store)?.users?.push(2);
That calls push on a read of the store, outside its setter. Solid ignores the write. In development it logs [STORE_WRITE_OUTSIDE_SETTER] Writing store property "1" outside its setter was ignored; that warning is development-only, so a production build drops the write without a word.
Frames
| instant | action | frame |
|---|---|---|
| 0 | mount | add1 |
| 1 | click add |
add1 (the list is unchanged) |
splice behaves the same way, and so presumably do the other mutating methods (pop, shift, unshift, sort, reverse, fill, copyWithin, and Map/Set writes). A program can also reach this through a plain function the handler calls with the source's value, which the checker may not be able to see. The direct call on a source path is the case it can see.
Version: main at e650b85.
- Lingua principale
- TypeScript
- Stelle
- 127
- Fork
- 7
- Merge medio
- 15h 42m
- PR unite (30g)
- 63
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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/reactivescript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
solidjs/reactivescript#96 ·
I maintainer di solito rispondono entro 1 giorno
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedForse già presa @cgaaf l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
solidjs/reactivescript#84 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
solidjs/reactivescript#77 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
solidjs/reactivescript#74 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
solidjs/reactivescript#83 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di solidjs/reactivescript
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
GetStream/stream-chat-react#3467 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
vercel-labs/ui#1139 ·
I maintainer di solito rispondono entro 1 giorno
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Forse già presa @goranai l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bot:ai-assisted component:platform-js status:untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
midnightntwrk/platform-js#93 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100