From bf5546b112f9ab31618859f0161ca2ece44ffefd Mon Sep 17 00:00:00 2001 From: cbm Date: Sat, 13 Jul 2024 16:43:21 +0800 Subject: [PATCH] debug:adjust sync order --- app/store/sync.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/store/sync.ts b/app/store/sync.ts index 63e9ad17d..72a052661 100644 --- a/app/store/sync.ts +++ b/app/store/sync.ts @@ -96,6 +96,8 @@ 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); if (!remoteState || remoteState === "") { @@ -107,14 +109,14 @@ export const useSyncStore = createPersistStore( await client.get(config.username), ) as AppState; mergeAppState(localState, parsedRemoteState); - //setLocalAppState(localState); + setLocalAppState(localState); } } catch (e) { console.log("[Sync] failed to get remote state", e); throw e; } - //await client.set(config.username, JSON.stringify(localState)); + this.markSyncTime(); },