From 82ca8e3a55f26a8709251f161224e92b93fc5828 Mon Sep 17 00:00:00 2001
From: Mohamed Bassem <me@mbassem.com>
Date: Sun, 9 Mar 2025 15:34:24 +0000
Subject: fix: Add error boundary around bookmark cards

---
 apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx')

diff --git a/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx b/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx
index bb3222a7..b8e8d1e6 100644
--- a/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx
+++ b/apps/web/components/dashboard/bookmarks/BookmarksGrid.tsx
@@ -7,6 +7,7 @@ import {
 } from "@/lib/userLocalSettings/bookmarksLayout";
 import tailwindConfig from "@/tailwind.config";
 import { Slot } from "@radix-ui/react-slot";
+import { ErrorBoundary } from "react-error-boundary";
 import { useInView } from "react-intersection-observer";
 import Masonry from "react-masonry-css";
 import resolveConfig from "tailwindcss/resolveConfig";
@@ -15,6 +16,7 @@ import type { ZBookmark } from "@hoarder/shared/types/bookmarks";
 
 import BookmarkCard from "./BookmarkCard";
 import EditorCard from "./EditorCard";
+import UnknownCard from "./UnknownCard";
 
 function StyledBookmarkCard({ children }: { children: React.ReactNode }) {
   return (
@@ -78,9 +80,11 @@ export default function BookmarksGrid({
       </StyledBookmarkCard>
     ),
     ...bookmarks.map((b) => (
-      <StyledBookmarkCard key={b.id}>
-        <BookmarkCard bookmark={b} />
-      </StyledBookmarkCard>
+      <ErrorBoundary key={b.id} fallback={<UnknownCard bookmark={b} />}>
+        <StyledBookmarkCard>
+          <BookmarkCard bookmark={b} />
+        </StyledBookmarkCard>
+      </ErrorBoundary>
     )),
   ];
   return (
-- 
cgit v1.2.3-70-g09d2

