feat: add preinit setting

This commit is contained in:
Gabe
2025-09-25 11:31:12 +08:00
parent 1dabbfc4de
commit 393f1a29d5
10 changed files with 613 additions and 538 deletions

View File

@@ -53,9 +53,9 @@ export function useStorage(key, defaultVal = null, syncKey = "") {
// 远端同步
const runSync = useCallback(async (keyToSync, valueToSync) => {
try {
const { value, isNew } = await syncData(keyToSync, valueToSync);
if (isNew) {
setData(value);
const res = await syncData(keyToSync, valueToSync);
if (res?.isNew) {
setData(res.value);
}
} catch (error) {
kissLog("Sync failed", keyToSync);