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
- Fixed commit() not throwing errors - The
commit()
method now properly throws errors when the mutation function fails, matching the documented behavior. Bothawait tx.commit()
andawait 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.