From 866a45cc84057e15ec623df8a5d297cb2333d24d Mon Sep 17 00:00:00 2001 From: DigitalPhoenixX Date: Mon, 7 Feb 2022 21:46:52 +0200 Subject: [PATCH] fix: update bookmarks cache after move --- components/Bookmarks/MoveBookmarkButtons.jsx | 22 +++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/components/Bookmarks/MoveBookmarkButtons.jsx b/components/Bookmarks/MoveBookmarkButtons.jsx index 9fd2f0d..64b8eb8 100644 --- a/components/Bookmarks/MoveBookmarkButtons.jsx +++ b/components/Bookmarks/MoveBookmarkButtons.jsx @@ -32,12 +32,24 @@ const MoveBookmarkButtons = ({ queryClient.setQueryData( getBookmarksFolderQueryKey( store.profileId, - inRootBookmark ? undefined : fromBookmarkId + undefined ), - (oldData) => ({ - ...oldData, - posts: oldData.posts.filter((item) => item.id !== postId), - }) + (oldData) => + oldData && { + ...oldData, + posts: oldData.posts.filter((item) => item.id !== postId), + } + ); + queryClient.setQueryData( + getBookmarksFolderQueryKey( + store.profileId, + fromBookmarkId + ), + (oldData) => + oldData && { + ...oldData, + posts: oldData.posts.filter((item) => item.id !== postId), + } ); queryClient.setQueryData( getBookmarksFolderQueryKey(