fix: Correct merge logic for state updates in sync utility

This commit is contained in:
michaelia 2025-02-21 13:01:33 +00:00
parent f5f3ce94f6
commit 357b74da59

View File

@ -153,9 +153,9 @@ export function mergeWithUpdate<T extends { lastUpdateTime?: number }>(
remoteState: T,
) {
const localUpdateTime = localState.lastUpdateTime ?? 0;
const remoteUpdateTime = localState.lastUpdateTime ?? 1;
const remoteUpdateTime = remoteState.lastUpdateTime ?? 1;
if (localUpdateTime < remoteUpdateTime) {
if (localUpdateTime > remoteUpdateTime) {
merge(remoteState, localState);
return { ...remoteState };
} else {