@tanstack/db-sqlite-persistence-core 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/db-sqlite-persistence-core",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "SQLite persisted collection core for TanStack DB",
5
5
  "author": "TanStack Team",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@standard-schema/spec": "^1.1.0",
43
- "@tanstack/db": "0.6.13"
43
+ "@tanstack/db": "0.6.14"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "typescript": ">=4.7"
package/src/persisted.ts CHANGED
@@ -2290,9 +2290,21 @@ function createWrappedSyncConfig<
2290
2290
  message.type === `insert` &&
2291
2291
  normalization.operation.metadata === undefined
2292
2292
  ) {
2293
- openTransaction.rowMetadataWrites.set(normalization.operation.key, {
2294
- type: `delete`,
2295
- })
2293
+ // Reset stale metadata for a fresh insert, but don't clobber an
2294
+ // explicit metadata write already queued for this key in the same
2295
+ // transaction (e.g. query reconcile stamps owners, then inserts).
2296
+ if (
2297
+ !openTransaction.rowMetadataWrites.has(
2298
+ normalization.operation.key,
2299
+ )
2300
+ ) {
2301
+ openTransaction.rowMetadataWrites.set(
2302
+ normalization.operation.key,
2303
+ {
2304
+ type: `delete`,
2305
+ },
2306
+ )
2307
+ }
2296
2308
  } else if (normalization.operation.metadata !== undefined) {
2297
2309
  openTransaction.rowMetadataWrites.set(normalization.operation.key, {
2298
2310
  type: `set`,