github TanStack/db @tanstack/db@0.3.0

latest releases: @tanstack/vue-db@0.0.53, @tanstack/trailbase-db-collection@0.1.20, @tanstack/svelte-db@0.1.20...
10 hours ago

Minor Changes

  • Fix transaction error handling to match documented behavior and preserve error identity (#558)

    Breaking Changes

    • commit() now throws errors when the mutation function fails (previously returned a failed transaction)

    Bug Fixes

    1. Fixed commit() not throwing errors - The commit() method now properly throws errors when the mutation function fails, matching the documented behavior. Both await tx.commit() and await tx.isPersisted.promise now work correctly in try/catch blocks.

    Migration Guide

    If you were catching errors from commit() by checking the transaction state:

    // Before - commit() didn't throw
    await tx.commit()
    if (tx.state === "failed") {
      console.error("Failed:", tx.error)
    }
    
    // After - commit() now throws
    try {
      await tx.commit()
    } catch (error) {
      console.error("Failed:", error)
    }

Patch Changes

  • Improve mutation merging from crude replacement to sophisticated merge logic (#557)

    Previously, mutations were simply replaced when operating on the same item. Now mutations are intelligently merged based on their operation types (insert vs update vs delete), reducing network overhead and better preserving user intent.

Don't miss a new db release

NewReleases is sending notifications on new releases.