Skip to content
Source
Sign inSign up
TanStack/db

fix: handle Temporal objects correctly in proxy deepClone and deepEqual #434

MergedKyleAMathewsmerged 6 commits intomain fromrefs/pull/434/headmerged by KyleAMathews

Showing 10 changed files with 30 additions and 132 deletions (loading 6).

x
0 of 10 viewed, 10 left
11 additions and 0 deletions.changeset/thick-singers-appear.mdAdded
View file
@@ -0,0 +1,11 @@
+---
+"@tanstack/db": patch
+---
+​
+Fix handling of Temporal objects in proxy's deepClone and deepEqual functions
+​
+- Temporal objects (like Temporal.ZonedDateTime) are now properly preserved during cloning instead of being converted to empty objects
+- Added detection for all Temporal API object types via Symbol.toStringTag
+- Temporal objects are returned directly from deepClone since they're immutable
+- Added proper equality checking for Temporal objects using their built-in equals() method
+- Prevents unnecessary proxy creation for immutable Temporal objects
3 additions and 25 deletionspackages/db/src/collection.tsModified
View file
@@ -1,4 +1,5 @@
import { withArrayChangeTracking, withChangeTracking } from "./proxy"
+import { deepEquals } from "./utils"
import { SortedMap } from "./SortedMap"
import {
createSingleRowRefProxy,
@@ -1448,7 +1449,7 @@
const isRedundantSync =
completedOp &&
newVisibleValue !== undefined &&
- this.deepEqual(completedOp.value, newVisibleValue)