Skip to content

Commit

Permalink
chore: Add error handling for parsing message data in Box3 component
Browse files Browse the repository at this point in the history
  • Loading branch information
deblanco committed Aug 5, 2024
1 parent ef1591a commit 3758133
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/src/Pages/Main/Components/Box3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ export const Box3 = () => {

useEffect(() => {
const fn = (ev: MessageEvent) => {
const data = JSON.parse(ev.data) as { type: string };
if (data.type !== "update") return;
token0.refetch();
try {
const data = JSON.parse(ev.data) as { type: string };
if (data.type !== "update") return;
token0.refetch();
} catch (e) {
console.error("IGNORE THIS:", e);
}
};
window.addEventListener("message", fn);

Expand Down

0 comments on commit 3758133

Please sign in to comment.