A functional write to a store path stores the function instead of applying it (W-6)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 84/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- compilers
Rechercherichtung
Beginne in ref/compile/rt-web.ts bei pathWrite, und spiegle jede Änderung in seiner Kopie in ref/compile/rt.ts wider. Vergleiche es mit guessInto direkt darunter, das bereits Funktionswerte anwendet; sorge dafür, dass die abschließende Pfadzuweisung v anwendet, wenn es eine Funktion ist. Führe den Compiler auf ref/compile/rt.ts mit dem Beispielprogramm aus und prüfe, dass die Click-Frames add1, add2, add3 durchlaufen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
A functional write to a path of a structured source stores the function instead of applying it. 02 W-6 says x := f writes f applied to the slot, and that "a path target applies f to the path's value", so cart.items := items => [...items, 2] should append. The compiler accepts the program and lowers the write to the runtime's path writer, which assigns f itself to cart.items.
Program
export default component App() {
source cart := { items: [1] }
<main>
<button onClick={() => { cart.items := items => [...items, 2] }}>add</button>
<p>{len(cart.items)}</p>
</main>
}
Frames
| instant | action | expected | compiled |
|---|---|---|---|
| 0 | mount | add1 |
add1 |
| 1 | click add |
add2 |
add0 |
| 2 | click add |
add3 |
add0 |
The expected column is the same program written with Solid's setter, setCart((d) => { d.items = ((items) => [...items, 2])(d.items); }), run on the same clicks. The compiled column is the crate's output on ref/compile/rt.ts.
Cause
pathWrite in ref/compile/rt-web.ts (and its copy in rt.ts) ends with o[keys[keys.length - 1]] = v. guessInto, two lines below it, already handles a function: o[last] = typeof v === "function" ? v(o[last]) : v. Doing the same in pathWrite would match W-6. It is the path writer of a plain structured source (path: pathWrite(setStore)) and of an optimistic store's truth (path: pathWrite(setTruth)).
Versions: main at e650b85. The published @reactivescript/runtime 0.3.1 has the same assignment inline in its store writer, so released apps are affected too.
- 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
-
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 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
solidjs/reactivescript#97 ·
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