Repository navigation
Commit 0212cba
fix(signals): draft reads compose overrides over a truth-staged backing
With several optimistic-store actions in flight (optimistic `votes++`,
server confirm, `refresh(store)`), the first vote's truth landing is staged
into the transaction that still retains the second vote (#3164 fold) and
that vote's increment replays over it. A third click's draft then read the
staged truth WITHOUT the replayed override: draft reads composed live
overrides only while `pb === null`, on the assumption that an existing
pending backing was the draft's own view-seeded clone. ensurePB's hand-off
parks a truth-staged backing and reseeds from the view on the draft's
first WRITE, but `votes++` reads first — base 1, wrote 2, and the override
it emitted landed on the value already displayed. The click was invisible
and the count stuck (or fell back) until truth caught up; ten rapid votes
showed 1, 2, 3, 4, then 2, then 5.
Draft reads now compose overrides whenever the pending backing is not the
draft's own tentative clone (tentativePBs), in all four draft paths (data
key, hot path, has, ownKeys). Regression in the #2951 refetch-hold suite:
three votes in flight, the third made after the first landing, every
visible value monotonic.
Co-Authored-By: Claude Fable 5.1 <[email protected]>1 parent 439a2fe commit 0212cba
3 files changed
Lines changed: 130 additions & 5 deletions
File tree
- .changeset
- packages/signals
- src/store/next
- tests
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
638 | 654 | | |
639 | 655 | | |
640 | 656 | | |
| |||
1392 | 1408 | | |
1393 | 1409 | | |
1394 | 1410 | | |
1395 | | - | |
| 1411 | + | |
1396 | 1412 | | |
1397 | 1413 | | |
1398 | 1414 | | |
| |||
1614 | 1630 | | |
1615 | 1631 | | |
1616 | 1632 | | |
1617 | | - | |
| 1633 | + | |
1618 | 1634 | | |
1619 | 1635 | | |
1620 | 1636 | | |
| |||
1655 | 1671 | | |
1656 | 1672 | | |
1657 | 1673 | | |
1658 | | - | |
| 1674 | + | |
1659 | 1675 | | |
1660 | 1676 | | |
1661 | 1677 | | |
| |||
1688 | 1704 | | |
1689 | 1705 | | |
1690 | 1706 | | |
1691 | | - | |
| 1707 | + | |
1692 | 1708 | | |
1693 | 1709 | | |
1694 | 1710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
0 commit comments