@pylonsync/sync 0.3.359 → 0.3.360
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 +1 -1
- package/src/index.ts +13 -6
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1524,14 +1524,21 @@ export class SyncEngine {
|
|
|
1524
1524
|
): Promise<void> {
|
|
1525
1525
|
const wipeMutations = opts.wipeMutations === true;
|
|
1526
1526
|
this.cursor = { last_seq: 0 };
|
|
1527
|
-
|
|
1528
|
-
//
|
|
1529
|
-
//
|
|
1530
|
-
//
|
|
1531
|
-
//
|
|
1532
|
-
//
|
|
1527
|
+
// The replica is about to be wiped and will re-pull from 0 (org switch,
|
|
1528
|
+
// identity flip, or a 410 cursor reset). Re-enter "loading" until that
|
|
1529
|
+
// re-pull lands rows — otherwise switching to another org flashes an empty
|
|
1530
|
+
// list for the seconds the snapshot takes. Re-arm the fallback so it can't
|
|
1531
|
+
// pin; the arriving rows (populated org) or the deadline (empty org)
|
|
1532
|
+
// re-settle it.
|
|
1533
|
+
//
|
|
1534
|
+
// ORDER MATTERS: this must precede `clearAll()`. `clearAll()` is the only
|
|
1535
|
+
// notify on this path, and it used to run FIRST — so every subscriber
|
|
1536
|
+
// re-read the signal while it was still `true`, and the flip to `false` on
|
|
1537
|
+
// the next line reached nobody. The documented protection above silently
|
|
1538
|
+
// did nothing: an org switch dropped straight to the new org's empty list.
|
|
1533
1539
|
this._initialSyncSettled = false;
|
|
1534
1540
|
this.armInitialSyncFallback();
|
|
1541
|
+
this.store.clearAll();
|
|
1535
1542
|
// Disk is about to be wiped + re-pulled from 0, so any prior
|
|
1536
1543
|
// persist degradation is moot — start the durability invariant
|
|
1537
1544
|
// fresh. (If the fresh snapshot also fails to persist, enqueueApply
|