github TanStack/db @tanstack/electric-db-collection@0.2.4

Patch Changes

  • Fixed bug where like() and ilike() operators were not working in on-demand mode. The SQL compiler was incorrectly treating these operators as function calls (LIKE(column, pattern)) instead of binary operators (column LIKE pattern). Now like() and ilike() correctly compile to SQL binary operator syntax, enabling search queries with pattern matching in on-demand mode. This fix supports patterns like like(lower(offers.title), '%search%') and combining multiple conditions with or(). (#884)

  • Fix progressive mode to use fetchSnapshot and atomic swap (#852)

    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:

    Core Changes:

    • Use fetchSnapshot() during initial sync to fetch and apply snapshots immediately in sync transactions
    • Buffer all stream messages during initial sync (renamed flag to isBufferingInitialSync)
    • Perform atomic swap on first up-to-date: truncate snapshot data → apply buffered messages → mark ready
    • Track txids/snapshots only after atomic swap (enables correct optimistic transaction confirmation)

    Test Infrastructure:

    • Added ELECTRIC_TEST_HOOKS symbol for test control (hidden from public API)
    • Added progressiveTestControl.releaseInitialSync() to E2E test config for explicit transition control
    • Created comprehensive progressive mode E2E test suite (8 tests):
      • Explicit snapshot phase and atomic swap validation
      • Txid tracking behavior (Electric-only)
      • Multiple concurrent snapshots with deduplication
      • Incremental updates after swap
      • Predicate handling and resilience tests

    Bug Fixes:

    • Fixed type errors in test files
    • All 166 unit tests + 95 E2E tests passing
  • Updated dependencies [acb3e4f, 464805d, 2c2e4db, 15c772f]:

    • @tanstack/db@0.5.4

Don't miss a new db release

NewReleases is sending notifications on new releases.