@@ -234,10 +234,11 @@ async function applyRemoteUpdate() {
|
||||
if (stateFingerprint(current) === stateFingerprint(snapshot)) return;
|
||||
} catch (_) {}
|
||||
}
|
||||
// Never overwrite our state with a snapshot that has less content (avoids empty overwriting master or peer).
|
||||
// Only skip when the snapshot is empty and we have content (avoids empty overwriting after a bad merge or cold peer).
|
||||
// Do not skip when snapshot has fewer items due to user deletions — those are valid live updates.
|
||||
const currentSize = current ? snapshotContentSize(current) : snapshotContentSize(holesailManager.getStateSnapshot());
|
||||
const snapshotSize = snapshotContentSize(snapshot);
|
||||
if (snapshotSize < currentSize) return;
|
||||
if (snapshotSize === 0 && currentSize > 0) return;
|
||||
await applySyncedState(snapshot);
|
||||
lastSyncedAt = Date.now();
|
||||
if (emitEvent) emitEvent('syncApplied', {});
|
||||
|
||||
Reference in New Issue
Block a user