diff --git a/app/store/sync.ts b/app/store/sync.ts index 72a052661..5112b4132 100644 --- a/app/store/sync.ts +++ b/app/store/sync.ts @@ -96,7 +96,7 @@ export const useSyncStore = createPersistStore( const config = get()[provider]; const client = this.getClient(); - await client.set(config.username, JSON.stringify(localState)); + try { const remoteState = await client.get(config.username); @@ -116,6 +116,8 @@ export const useSyncStore = createPersistStore( throw e; } + await client.set(config.username, JSON.stringify(localState)); + this.markSyncTime(); diff --git a/app/utils/sync.ts b/app/utils/sync.ts index 1acfc1289..4b2f6e35d 100644 --- a/app/utils/sync.ts +++ b/app/utils/sync.ts @@ -137,9 +137,12 @@ export function setLocalAppState(appState: AppState) { export function mergeAppState(localState: AppState, remoteState: AppState) { Object.keys(localState).forEach((k: string) => { const key = k as T; - const localStoreState = localState[key]; - const remoteStoreState = remoteState[key]; - MergeStates[key](localStoreState, remoteStoreState); + //if(k !== ''){ + console.log('mergeAppState',k) + const localStoreState = localState[key]; + const remoteStoreState = remoteState[key]; + MergeStates[key](localStoreState, remoteStoreState); + //} }); return localState;