Commit 307fdf8
* test: cover re-preloading a live query after cleanup
Add a regression test asserting that a live query loads its data again
when it is preloaded after the live query and its source collection were
cleaned up (e.g. when switching data sets at runtime).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix: reset live query error state on sync restart so preload recovers after cleanup (#1576)
A source collection that is cleaned up while a live query depends on it
pushes the live query into an error state and latches `isInErrorState`.
That flag was never reset, so when sync restarted via preload() after
cleanup (e.g. switching profiles without a page refresh),
updateLiveQueryStatus() returned early, markReady() was never called and
the preload promise hung forever.
Reset `isInErrorState` at the start of each sync session so the live
query can become ready again.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9a5e8e5 commit 307fdf8
3 files changed
Lines changed: 36 additions & 0 deletions
File tree
- .changeset
- packages/db
- src/query/live
- tests/query
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
| 599 | + | |
| 600 | + | |
599 | 601 | | |
600 | 602 | | |
601 | 603 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
597 | 624 | | |
598 | 625 | | |
599 | 626 | | |
| |||
0 commit comments