Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

fix: Refresh the search cache when a bookmark is deleted. Fixes #26

MohamedBassem6e90035fa811
diff --git a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
index a639b949..e95ec9a2 100644
--- a/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
+++ b/apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
@@ -52,6 +52,9 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
const invalidateBookmarkCache =
api.useUtils().bookmarks.getBookmark.invalidate;
+ const invalidateSearchCache =
+ api.useUtils().bookmarks.searchBookmarks.invalidate;
+
const onError = () => {
toast({
variant: "destructive",
@@ -68,6 +71,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
onError,
onSettled: () => {
invalidateAllBookmarksCache();
+ invalidateSearchCache();
},
});
@@ -81,6 +85,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
onSettled: () => {
invalidateBookmarkCache({ bookmarkId: bookmark.id });
invalidateAllBookmarksCache();
+ invalidateSearchCache();
},
});