Repository navigation
Commit 4db98b4
committed
fix(signals): unchanged store key read under an adoption hold does not hold the reader (#3706)
A derived store adopting a new backing while a transaction is still open
puts the whole container under an adoption hold, and readSource's
adoption-hold arm entered every deriving read of that container into the
transaction, whichever key was read. In the report, confirming one
optimistic move while another was pending landed the authoritative array
under the still-open shared transaction, and a memo reading
`drag() === cards[0].id` beside an independent `drag` signal was held until
the second move settled, so isPending(drag) went true. The other two
reproductions (a nested <Show> preview over `cards.find(...)`, and a single
action writing rows before its yield with the preview mounting afterwards)
reach the same arm through an inherited array method and through a row
first read after the adoption.
The arm now compares the read key across the held and adopted backings
(own on both, never an accessor, the store's slot equality so a
re-ingested row is the same logical slot; or own on neither with the same
prototype). A child slot nobody read before the adoption has no target to
compare, so it is materialized under the parent's hold with the old raw as
its held view and its own leaves decide: sameLogicalSlot recognizes such a
child through that held view, and the parent's slot node is seeded with
the adopted raw so the reader is served that child. A key that reads the
same from either backing derives nothing from the hold and takes the
ordinary pending-backing selection with no transaction entry and no stale
replay. This is the adoption twin of the fold gate's written-key scoping
(#3688). Keyless reads, chained backings, a chained held view, optimistic
families, shallow stores, raw-marked values, relocated rows and descriptor
reads whose flags changed keep the whole-container hold.
Size: +765 B minified on the store read path; brotli +149..+224 B, four caps
ratcheted (+ createStore 16.71 -> 16.94 KB, hydrating + every store
30.63 -> 30.80 KB, base page 44.93 -> 45.02 KB, live page 49.10 -> 49.28 KB).1 parent 6958367 commit 4db98b4
9 files changed
Lines changed: 853 additions & 16 deletions
File tree
- .changeset
- packages
- signals
- docs
- src/store/next
- tests
- web/test
- scripts/size
| 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 | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
310 | 310 | | |
311 | 311 | | |
312 | 312 | | |
313 | | - | |
314 | | - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
315 | 320 | | |
316 | 321 | | |
317 | 322 | | |
| |||
437 | 442 | | |
438 | 443 | | |
439 | 444 | | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
440 | 486 | | |
441 | 487 | | |
442 | 488 | | |
| |||
448 | 494 | | |
449 | 495 | | |
450 | 496 | | |
451 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
452 | 501 | | |
453 | 502 | | |
454 | 503 | | |
| |||
1785 | 1834 | | |
1786 | 1835 | | |
1787 | 1836 | | |
1788 | | - | |
1789 | | - | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
1790 | 1844 | | |
1791 | 1845 | | |
1792 | 1846 | | |
| |||
1797 | 1851 | | |
1798 | 1852 | | |
1799 | 1853 | | |
1800 | | - | |
1801 | | - | |
1802 | | - | |
1803 | | - | |
1804 | | - | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
1805 | 1859 | | |
1806 | 1860 | | |
1807 | 1861 | | |
| |||
2444 | 2498 | | |
2445 | 2499 | | |
2446 | 2500 | | |
2447 | | - | |
| 2501 | + | |
2448 | 2502 | | |
2449 | 2503 | | |
2450 | 2504 | | |
| |||
0 commit comments