Repository navigation
Commit aca6cda
fix(signals): rewriting an orphan override opens no transaction (#3576)
optimisticWrite passed whatever resolveTransition returned to
initTransition when the node already carried an override. For an override
no transaction owns (an ambient optimistic write, or the latest() shadow's
first companion sync) that is null, and initTransition reads null as "open
a fresh transaction": the ambient batch was adopted into it, every plain
write staged in the same tick was stamped as its pending node, and
activeTransition stayed set for the rest of the caller's block.
The latest() shadow made this reachable from a plain read: after one
latest(() => store.value), the second setStore write in a tick synced the
shadow through this path, the store node was stamped held, foldHeld
masked the projection's pending backing from context-free readers, and
store.value read back 0, 1, 0, 0, 0 where the same writes without the
latest() read gave 0, 1, 2, 3, 4.
Join a transaction only when one is resolved, as the same-value branch of
the write already does.
Co-authored-by: Cursor <[email protected]>1 parent e10a4ba commit aca6cda
3 files changed
Lines changed: 36 additions & 5 deletions
File tree
- .changeset
- packages/signals
- src/core
- tests/store
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments