aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-27 17:24:46 +0000
committerMohamedBassem <me@mbassem.com>2024-03-27 17:25:03 +0000
commit6e90035fa811180a59465b5e79987bafef302d59 (patch)
tree584ae8a76702aed826db269f719efd046ba20a01 /apps
parente8628b586181ea99980b0beafd9976cabfdd077e (diff)
downloadkarakeep-6e90035fa811180a59465b5e79987bafef302d59.tar.zst
fix: Refresh the search cache when a bookmark is deleted. Fixes #26
Diffstat (limited to 'apps')
-rw-r--r--apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx5
1 files changed, 5 insertions, 0 deletions
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();
},
});