diff --git a/apps/web/src/components/Post/Actions/Like.tsx b/apps/web/src/components/Post/Actions/Like.tsx index 0c61a5407831..d1bec2afb2b0 100644 --- a/apps/web/src/components/Post/Actions/Like.tsx +++ b/apps/web/src/components/Post/Actions/Like.tsx @@ -40,9 +40,12 @@ const Like: FC = ({ post, showCount }) => { }); cache.modify({ fields: { - reactions: () => (hasReacted ? reactions - 1 : reactions + 1) + stats: (existingData) => ({ + ...existingData, + reactions: hasReacted ? reactions - 1 : reactions + 1 + }) }, - id: cache.identify(post.stats) + id: cache.identify(post) }); }; diff --git a/apps/web/src/components/Post/Actions/Menu/Bookmark.tsx b/apps/web/src/components/Post/Actions/Menu/Bookmark.tsx index dcb0ab38e331..8f2d6a01129b 100644 --- a/apps/web/src/components/Post/Actions/Menu/Bookmark.tsx +++ b/apps/web/src/components/Post/Actions/Menu/Bookmark.tsx @@ -36,9 +36,12 @@ const Bookmark: FC = ({ post }) => { }); cache.modify({ fields: { - bookmarks: () => (hasBookmarked ? bookmarks - 1 : bookmarks + 1) + stats: (existingData) => ({ + ...existingData, + bookmarks: hasBookmarked ? bookmarks - 1 : bookmarks + 1 + }) }, - id: cache.identify(post.stats) + id: cache.identify(post) }); // Remove bookmarked post from bookmarks feed diff --git a/apps/web/src/components/Post/Actions/Share/Repost.tsx b/apps/web/src/components/Post/Actions/Share/Repost.tsx index 710a0156b1a7..f8f17757552a 100644 --- a/apps/web/src/components/Post/Actions/Share/Repost.tsx +++ b/apps/web/src/components/Post/Actions/Share/Repost.tsx @@ -62,8 +62,13 @@ const Repost: FC = ({ isLoading, post, setIsLoading }) => { id: cache.identify(post.operations as LoggedInPostOperations) }); cache.modify({ - fields: { reposts: () => shares + 1 }, - id: cache.identify(post.stats) + fields: { + stats: (existingData) => ({ + ...existingData, + reposts: shares + 1 + }) + }, + id: cache.identify(post) }); }; diff --git a/apps/web/src/components/Post/OpenAction/CollectModule/CollectAction.tsx b/apps/web/src/components/Post/OpenAction/CollectModule/CollectAction.tsx index afb80e5dba80..3fb0db28c841 100644 --- a/apps/web/src/components/Post/OpenAction/CollectModule/CollectAction.tsx +++ b/apps/web/src/components/Post/OpenAction/CollectModule/CollectAction.tsx @@ -109,8 +109,13 @@ const CollectAction: FC = ({ id: cache.identify(post) }); cache.modify({ - fields: { countOpenActions: () => countOpenActions + 1 }, - id: cache.identify(post.stats) + fields: { + stats: (existingData) => ({ + ...existingData, + countOpenActions: countOpenActions + 1 + }) + }, + id: cache.identify(post) }); };