Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

CHANGELOG.md

348 lines16.5 KB

@tanstack/offline-transactions

1.0.30

Patch Changes

1.0.29

Patch Changes

  • Updated dependencies [1e69dd6]:
    • @tanstack/db@0.6.4

1.0.28

Patch Changes

1.0.27

Patch Changes

1.0.26

Patch Changes

  • Update all SKILL.md files to v0.6.0 with new documentation for persistence, virtual properties, queryOnce, createEffect, includes, indexing, and sync metadata. Add tanstack-intent keyword to all packages with skills. (#1421)

  • Updated dependencies [8b7fb1a]:

    • @tanstack/db@0.6.1

1.0.25

Patch Changes

1.0.24

Patch Changes

  • Updated dependencies [c3e6a96]:
    • @tanstack/db@0.5.33

1.0.23

Patch Changes

1.0.22

Patch Changes

  • Add Intent agent skills (SKILL.md files) to guide AI coding agents. Include skills for core DB concepts, all 5 framework bindings, meta-framework integration, and offline transactions. Also add export * from '@tanstack/db' to angular-db for consistency with other framework packages. (#1330)

  • Updated dependencies [bf1d078]:

    • @tanstack/db@0.5.31

1.0.21

Patch Changes

  • Fix retry behavior to not cap at 10 attempts and not burn retries while offline. Default retry policy now retries indefinitely with exponential backoff. Execution loop and retry timer check online status before attempting transactions. OnlineDetector.isOnline() is now a required method on the interface. OfflineExecutor.notifyOnline() has been removed — the online detector handles connectivity changes automatically. (#1301)

1.0.20

Patch Changes

  • Fix KeyScheduler to enforce strict FIFO ordering on retries. Previously, the scheduler could skip past a transaction waiting for retry and execute a later one, causing dependent UPDATE-before-INSERT failures. Also refactored getNextBatch to getNext to reflect that it always returns at most one transaction. (#1300)

  • Updated dependencies [e9d0fd8]:

    • @tanstack/db@0.5.30

1.0.19

Patch Changes

1.0.18

Patch Changes

  • Updated dependencies [46450e7]:
    • @tanstack/db@0.5.28

1.0.17

Patch Changes

1.0.16

Patch Changes

1.0.15

Patch Changes

1.0.14

Patch Changes

  • Updated dependencies [7099459]:
    • @tanstack/db@0.5.24

1.0.13

Patch Changes

  • Fix optimistic state not being restored to collections on page refresh while offline. Pending transactions are now automatically rehydrated from storage and their optimistic mutations applied to the UI immediately on startup, providing a seamless offline experience. (#1169)

  • Updated dependencies [05130f2]:

    • @tanstack/db@0.5.23

1.0.12

Patch Changes

  • Updated dependencies [f9b741e]:
    • @tanstack/db@0.5.22

1.0.11

Patch Changes

  • Fix date field corruption after app restart. String values matching ISO date format were incorrectly converted to Date objects during deserialization, corrupting user data. Now only explicit Date markers are converted, preserving string values intact. (#1127)

  • Fix mutation.changes field being lost during offline transaction serialization. Previously, the changes field was not included in serialized mutations, causing it to be empty ({}) after app restart. This led to sync functions receiving incomplete data when using mutation.changes for partial updates. (#1124)

  • Introduce specialized OnlineDetector for React Native (#1137)

  • Updated dependencies [6745ed0, 1b22e40, 7a2cacd, bdf9405]:

    • @tanstack/db@0.5.21

1.0.10

Patch Changes

  • Updated dependencies []:
    • @tanstack/db@0.5.20

1.0.9

Patch Changes

1.0.8

Patch Changes

  • Updated dependencies [c1247e8]:
    • @tanstack/db@0.5.18

1.0.7

Patch Changes

  • Fix race condition that caused double replay of offline transactions on page load. The issue occurred when WebLocksLeader's async lock acquisition triggered the leadership callback after requestLeadership() had already returned, causing loadAndReplayTransactions() to be called twice. (#1046)

  • Updated dependencies [f795a67, d542667, 6503c09, b1cc4a7]:

    • @tanstack/db@0.5.17

1.0.6

Patch Changes

  • Updated dependencies [41308b8]:
    • @tanstack/db@0.5.16

1.0.5

Patch Changes

  • Updated dependencies [32ec4d8]:
    • @tanstack/db@0.5.15

1.0.4

Patch Changes

  • Updated dependencies [26ed0aa]:
    • @tanstack/db@0.5.14

1.0.3

Patch Changes

1.0.2

Patch Changes

1.0.1

Patch Changes

  • Use regular dependency for @tanstack/db instead of peerDependency to match the standard pattern used by other TanStack DB packages and prevent duplicate installations (#952)

  • Updated dependencies [c4b9399, a1a484e]:

    • @tanstack/db@0.5.11

1.0.0

Patch Changes

0.1.3

Patch Changes

  • Fix dependency bundling issues by moving @tanstack/db to peerDependencies (#766)

    What Changed:

    Moved @tanstack/db from regular dependencies to peerDependencies in:

    • @tanstack/offline-transactions
    • @tanstack/query-db-collection

    Removed @opentelemetry/api dependency from @tanstack/offline-transactions.

    Why:

    These extension packages incorrectly declared @tanstack/db as both a regular dependency AND a peerDependency simultaneously. This caused lock files to develop conflicting versions, resulting in multiple instances of @tanstack/db being installed in consuming applications.

    The fix removes @tanstack/db from regular dependencies and keeps it only as a peerDependency. This ensures only one version of @tanstack/db is installed in the dependency tree, preventing version conflicts.

    For local development, @tanstack/db remains in devDependencies so the packages can be built and tested independently.

  • Updated dependencies [6c55e16, 7805afb, 1367756]:

    • @tanstack/db@0.4.20

0.1.2

Patch Changes

  • Updated dependencies [75470a8]:
    • @tanstack/db@0.4.19

0.1.1

Patch Changes

0.1.0

Minor Changes

  • Add offline-transactions package with robust offline-first capabilities (#559)

    New package @tanstack/offline-transactions provides a comprehensive offline-first transaction system with:

    Core Features:

    • Persistent outbox pattern for reliable transaction processing
    • Leader election for multi-tab coordination (Web Locks API with BroadcastChannel fallback)
    • Automatic storage capability detection with graceful degradation
    • Retry logic with exponential backoff and jitter
    • Sequential transaction processing (FIFO ordering)

    Storage:

    • Automatic fallback chain: IndexedDB → localStorage → online-only
    • Detects and handles private mode, SecurityError, QuotaExceededError
    • Custom storage adapter support
    • Diagnostic callbacks for storage failures

    Developer Experience:

    • TypeScript-first with full type safety
    • Comprehensive test suite (25 tests covering leader failover, storage failures, e2e scenarios)
    • Works in all modern browsers and server-side rendering environments

    @tanstack/db improvements:

    • Enhanced duplicate instance detection (dev-only, iframe-aware, with escape hatch)
    • Better environment detection for SSR and worker contexts

    Example usage:

    import {
      startOfflineExecutor,
      IndexedDBAdapter,
    } from '@tanstack/offline-transactions'
    
    const executor = startOfflineExecutor({
      collections: { todos: todoCollection },
      storage: new IndexedDBAdapter(),
      mutationFns: {
        syncTodos: async ({ transaction, idempotencyKey }) => {
          // Sync mutations to backend
          await api.sync(transaction.mutations, idempotencyKey)
        },
      },
      onStorageFailure: (diagnostic) => {
        console.warn('Running in online-only mode:', diagnostic.message)
      },
    })
    
    // Create offline transaction
    const tx = executor.createOfflineTransaction({
      mutationFnName: 'syncTodos',
      autoCommit: false,
    })
    
    tx.mutate(() => {
      todoCollection.insert({ id: '1', text: 'Buy milk', completed: false })
    })
    
    await tx.commit() // Persists to outbox and syncs when online

Patch Changes

  • Updated dependencies [49bcaa5]:
    • @tanstack/db@0.4.17