`store.users.push(x)` in a handler compiles with no diagnostic, and the write is lost
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 62/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- javascript, typescript
- Bereich
- compilers
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 127
- Forks
- 7
- Ø Merge
- 15 Std. 42 Min.
- Gemergte PRs (30 T.)
- 63
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus solidjs/reactivescript
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
solidjs/reactivescript#96 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedEvtl. vergeben @cgaaf hat das vor 1 Tag übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
solidjs/reactivescript#84 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
solidjs/reactivescript#77 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
solidjs/reactivescript#74 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
solidjs/reactivescript#83 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in solidjs/reactivescript
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
GetStream/stream-chat-react#3467 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
vercel-labs/ui#1139 ·
Maintainer antworten meist innerhalb von 1 Tag
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Evtl. vergeben @goranai hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag
-
bot:ai-assisted component:platform-js status:untriaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
midnightntwrk/platform-js#93 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100