From 768a27d37c7ea4b490a54571db43c0fe958ba291 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Mon, 17 Apr 2023 22:32:09 +0200 Subject: [PATCH] Also update counts even when no new remote content --- src/screens/Tabs/Shared/Toot.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index 5566f806..7876e6fc 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -258,6 +258,18 @@ const TabSharedToot: React.FC> = ({ } }) }) + } else { + queryClient.cancelQueries(queryKey.local) + queryClient.setQueryData(queryKey.local, old => { + return old?.map(local => { + const remoteMatch = data.find(remote => remote.uri === local.uri) + if (remoteMatch) { + return { ...local, ...updateCounts(remoteMatch) } + } else { + return local + } + }) + }) } }, onSettled: async () => {