fix 2
CI / Build & Test (push) Successful in 4m4s

This commit is contained in:
Raven Scott
2026-03-15 06:55:35 -04:00
parent 130c8a382f
commit ba2eae64c2
+3 -2
View File
@@ -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', {});