From e5edfd97a5e4450e4fdce321b34243c8cd7c693d Mon Sep 17 00:00:00 2001 From: cbm Date: Sat, 13 Jul 2024 16:56:28 +0800 Subject: [PATCH] debug:mergeAppState list key --- app/store/sync.ts | 4 +++- app/utils/sync.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) 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;