Skip to content

Commit 132b57f

Browse files
committed
changeset
1 parent 93ebf98 commit 132b57f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
"@tanstack/electric-db-collection": patch
3+
"@tanstack/db-collection-e2e": patch
4+
"@tanstack/db": patch
5+
---
6+
7+
Fix progressive mode to use fetchSnapshot and atomic swap
8+
9+
Progressive mode was broken because `requestSnapshot()` injected snapshots into the stream in causally correct position, which didn't work properly with the `full` mode stream. This release fixes progressive mode by:
10+
11+
**Core Changes:**
12+
- Use `fetchSnapshot()` during initial sync to fetch and apply snapshots immediately in sync transactions
13+
- Buffer all stream messages during initial sync (renamed flag to `isBufferingInitialSync`)
14+
- Perform atomic swap on first `up-to-date`: truncate snapshot data → apply buffered messages → mark ready
15+
- Track txids/snapshots only after atomic swap (enables correct optimistic transaction confirmation)
16+
17+
**Test Infrastructure:**
18+
- Added `ELECTRIC_TEST_HOOKS` symbol for test control (hidden from public API)
19+
- Added `progressiveTestControl.releaseInitialSync()` to E2E test config for explicit transition control
20+
- Created comprehensive progressive mode E2E test suite (8 tests):
21+
- Explicit snapshot phase and atomic swap validation
22+
- Txid tracking behavior (Electric-only)
23+
- Multiple concurrent snapshots with deduplication
24+
- Incremental updates after swap
25+
- Predicate handling and resilience tests
26+
27+
**Bug Fixes:**
28+
- Fixed type errors in test files
29+
- All 166 unit tests + 95 E2E tests passing
30+

0 commit comments

Comments
 (0)