@tanstack/db-sqlite-persistence-core 0.2.12 → 0.2.13

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.
@@ -541,6 +541,9 @@ class PersistedCollectionRuntime {
541
541
  this.withInternalApply(() => {
542
542
  this.syncControls.begin?.({ immediate: true });
543
543
  for (const row of rows) {
544
+ if (this.collection?._hasHydratedKey(row.key)) {
545
+ continue;
546
+ }
544
547
  this.syncControls.write?.({
545
548
  type: `update`,
546
549
  value: row.value,
@@ -1582,12 +1585,19 @@ function persistedCollectionOptions(options) {
1582
1585
  syncOptions.syncMode ?? `eager`,
1583
1586
  collectionId2
1584
1587
  );
1585
- return {
1588
+ const result2 = {
1586
1589
  ...syncOptions,
1587
1590
  id: collectionId2,
1588
1591
  sync: createWrappedSyncConfig(syncOptions.sync, runtime2),
1589
1592
  persistence: persistence2
1590
1593
  };
1594
+ return db.withCollectionConfigFactory(
1595
+ result2,
1596
+ () => persistedCollectionOptions({
1597
+ ...options,
1598
+ id: collectionId2
1599
+ })
1600
+ );
1591
1601
  }
1592
1602
  const { schemaVersion, ...localOnlyOptions } = options;
1593
1603
  const collectionId = localOnlyOptions.id ?? `persisted-collection:${db.safeRandomUUID()}`;
@@ -1645,7 +1655,7 @@ function persistedCollectionOptions(options) {
1645
1655
  ...localOnlyOptions.utils ?? {},
1646
1656
  ...persistedUtils
1647
1657
  };
1648
- return {
1658
+ const result = {
1649
1659
  ...localOnlyOptions,
1650
1660
  id: collectionId,
1651
1661
  persistence,
@@ -1657,6 +1667,13 @@ function persistedCollectionOptions(options) {
1657
1667
  startSync: true,
1658
1668
  gcTime: localOnlyOptions.gcTime ?? 0
1659
1669
  };
1670
+ return db.withCollectionConfigFactory(
1671
+ result,
1672
+ () => persistedCollectionOptions({
1673
+ ...options,
1674
+ id: collectionId
1675
+ })
1676
+ );
1660
1677
  }
1661
1678
  function encodePersistedStorageKey(key) {
1662
1679
  if (typeof key === `number`) {