fix(workbench): guard recent-item persistence
This commit is contained in:
parent
2746655bb4
commit
94a122ba6e
1 changed files with 6 additions and 1 deletions
|
|
@ -88,5 +88,10 @@ export function pushRecentItem(item: Omit<RecentItem, "timestamp">) {
|
|||
const items = getRecentItems().filter((r) => r.path !== item.path);
|
||||
items.unshift({ ...item, timestamp: Date.now() });
|
||||
if (items.length > MAX_RECENT) items.length = MAX_RECENT;
|
||||
localStorage.setItem(RECENT_KEY, JSON.stringify(items));
|
||||
try {
|
||||
localStorage.setItem(RECENT_KEY, JSON.stringify(items));
|
||||
} catch {
|
||||
// Recent-item persistence is best-effort. Restricted/private storage
|
||||
// contexts must not break command activation.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue