You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(db, db-ivm): support Temporal objects in join hashing and normalization (#1370)
* fix(db-ivm): hash Temporal objects by value instead of identity
Temporal objects (PlainDate, ZonedDateTime, etc.) have no enumerable own
properties, so Object.keys() returns [] and all instances produce
identical hashes. This causes the IVM join Index to treat old and new
rows as equal, silently swallowing updates when only a Temporal field
changed.
Hash Temporal objects by their Symbol.toStringTag type and toString()
representation to produce correct, value-based hashes.
Fixes#1367
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix(db, db-ivm): support Temporal objects in join hashing and normalization
Temporal objects have no enumerable properties, so hashPlainObject()
produced identical hashes for all Temporal values. This caused join
index updates to be silently swallowed when a Temporal field changed.
- Add Temporal-aware hashing via Symbol.toStringTag + toString()
- Add Temporal normalization in normalizeValue() for join key matching
- Add Temporal handling in ascComparator for correct sort ordering
- Add null guard to exported isTemporal()
- Convert temporalTypes from Array to Set for consistency
Fixes#1367
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix: replace as-any casts with proper TemporalLike types
Address review feedback from Sam Willis and CodeRabbit:
- Add TemporalLike interface in db-ivm for type-safe Temporal detection
- Make isTemporal a proper type guard (returns input is TemporalLike)
- Remove as-any casts in hashTemporal
- Add return type to createTemporalLike test helper
- Remove unnecessary casts in join regression test
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix: use real Temporal objects in hash tests instead of mocks
Add temporal-polyfill as devDependency to db-ivm and replace
createTemporalLike mocks with real Temporal.PlainDate, PlainTime,
PlainDateTime, and Instant objects in hash tests.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Ben Guericke <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Fix Temporal objects breaking live query updates when used with joins. Temporal objects (e.g. `Temporal.PlainDate`) have no enumerable properties, so the structural hash function produced identical hashes for all Temporal values, causing join index updates to be silently swallowed. Also add Temporal support to value normalization for join key matching and to the comparator for correct sort ordering.
0 commit comments