Skip to content

Commit 1372237

Browse files
fix
1 parent db525cf commit 1372237

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/r-store/src/state/middleware/withPersist.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ export function withPersist<T extends Record<string, unknown>, P extends Record<
106106
console.error(`[reactivity-store/persist] middleware failed, error: ${e.message}`);
107107
}
108108

109-
storage.removeItem?.(storageKey);
109+
try {
110+
storage.removeItem?.(storageKey);
111+
} catch {
112+
void 0;
113+
}
110114
}
111115

112116
re = reactive(re as object) as UnWrapMiddleware<T>;
@@ -127,7 +131,11 @@ export function withPersist<T extends Record<string, unknown>, P extends Record<
127131
console.error(`[reactivity-store/persist] cache newState error, error: %o`, e);
128132
}
129133

130-
storage.removeItem?.(storageKey);
134+
try {
135+
storage.removeItem?.(storageKey);
136+
} catch {
137+
void 0;
138+
}
131139
}
132140
}, options.debounceTime || 40);
133141

0 commit comments

Comments
 (0)