Repository navigation
Commit ae0ec3f
fix(store): deep() hears base and optimistic writes through chained views; stable row identity under overlays (#3323)
deep() over a derived view (createOptimisticStore(base), projections whose
backing is another store) never re-ran on base writes: the view's targets
chain to the inner store's proxies, base writes bump the INNER record's
witnesses, and the walk subscribed only the outer ones — while resolving
children to fresh non-chained wrappers of the base raw. The walk now reads
through the whole chain and resolves children to the targets the get trap
serves.
Investigating that surfaced two more holes in the same composition:
- deep() over any optimistic store was deaf to every write on a row added
under a held action: the row lives in presence/value overrides, and the
walk enumerated the raw backing. The ownKeys/getOwnPropertyDescriptor
trap bodies are now shared helpers (visibleKeys/visibleDescriptor) the
walk uses, so parity with readers is structural.
- A derived view's untouched rows came back as fresh proxies for the life of
an optimistic action and snapped back at settle. notifyOptimisticWrites
compared the inner store's child PROXIES to the draft's raws and marked
every row changed; it now compares unwrapped values. Chained targets
serving from a pending backing resolve inner-owned raws to the inner
proxy before wrapping (resolveChainedRaw), and snapshotWalk starts from
the family's wrapper when entering a level from a raw so outer overrides
below the root compose.
The dist-artifacts top-level-await scanner now skips comments; an apostrophe
in a module-scope docblock opened a phantom string and derailed its depth.
Closes #3323
Co-authored-by: Cursor <[email protected]>1 parent 1c9e9e7 commit ae0ec3f
7 files changed
Lines changed: 571 additions & 94 deletions
File tree
- .changeset
- packages/signals
- docs
- src/store/next
- tests
- store
- scripts/size
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
347 | 376 | | |
348 | 377 | | |
349 | 378 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
551 | 557 | | |
552 | 558 | | |
553 | | - | |
554 | | - | |
555 | | - | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
556 | 564 | | |
557 | 565 | | |
558 | 566 | | |
| |||
0 commit comments