Skip to content

Commit 9511627

Browse files
committed
wrap local storage writes in try catch
1 parent c61630a commit 9511627

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

apps/dashboard/src/app/nebula-app/(app)/components/ChatPageContent.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@ export function ChatPageContent(props: {
100100
setHasUserUpdatedContextFilters(true);
101101

102102
// Cache the chains when context is updated
103-
if (v?.chainIds && v.chainIds.length > 0) {
104-
localStorage.setItem(
105-
NEBULA_LAST_USED_CHAIN_IDS_KEY,
106-
JSON.stringify(v.chainIds),
107-
);
108-
} else {
109-
localStorage.removeItem(NEBULA_LAST_USED_CHAIN_IDS_KEY);
103+
try {
104+
if (v?.chainIds && v.chainIds.length > 0) {
105+
localStorage.setItem(
106+
NEBULA_LAST_USED_CHAIN_IDS_KEY,
107+
JSON.stringify(v.chainIds),
108+
);
109+
} else {
110+
localStorage.removeItem(NEBULA_LAST_USED_CHAIN_IDS_KEY);
111+
}
112+
} catch {
113+
// ignore local storage errors
110114
}
111115
}, []);
112116

@@ -148,7 +152,7 @@ export function ChatPageContent(props: {
148152
return updatedContextFilters;
149153
}
150154
} catch {
151-
// ignore
155+
// ignore local storage errors
152156
}
153157

154158
// if we don't have chains, use the active chain

0 commit comments

Comments
 (0)