Skip to content

Commit

Permalink
fix: Refresh the search cache when a bookmark is deleted. Fixes #26
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Mar 27, 2024
1 parent e8628b5 commit 6e90035
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/web/components/dashboard/bookmarks/BookmarkOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -68,6 +71,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
onError,
onSettled: () => {
invalidateAllBookmarksCache();
invalidateSearchCache();
},
});

Expand All @@ -81,6 +85,7 @@ export default function BookmarkOptions({ bookmark }: { bookmark: ZBookmark }) {
onSettled: () => {
invalidateBookmarkCache({ bookmarkId: bookmark.id });
invalidateAllBookmarksCache();
invalidateSearchCache();
},
});

Expand Down

0 comments on commit 6e90035

Please sign in to comment.