about summary refs log tree commit diff
path: root/src/screens/StarterPack/StarterPackScreen.tsx
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-06-26 18:57:57 -0700
committerGitHub <noreply@github.com>2024-06-26 18:57:57 -0700
commit5641a4393c15c666bb95306d722d1ebf805df8ba (patch)
tree8705c78ed63190ed54b36b72fe87460a596df909 /src/screens/StarterPack/StarterPackScreen.tsx
parent878b0476dd94e187504f503438ca8914a48ac630 (diff)
downloadvoidsky-5641a4393c15c666bb95306d722d1ebf805df8ba.tar.zst
update follows when pressing follow all (#4663)
Diffstat (limited to 'src/screens/StarterPack/StarterPackScreen.tsx')
-rw-r--r--src/screens/StarterPack/StarterPackScreen.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx
index bdf6f9dbe..7c5cfd0b7 100644
--- a/src/screens/StarterPack/StarterPackScreen.tsx
+++ b/src/screens/StarterPack/StarterPackScreen.tsx
@@ -23,14 +23,16 @@ import {
 import {cleanError} from '#/lib/strings/errors'
 import {logger} from '#/logger'
 import {useDeleteStarterPackMutation} from '#/state/queries/starter-packs'
+import {batchedUpdates} from 'lib/batchedUpdates'
 import {HITSLOP_20} from 'lib/constants'
 import {makeProfileLink, makeStarterPackLink} from 'lib/routes/links'
 import {CommonNavigatorParams, NavigationProp} from 'lib/routes/types'
 import {logEvent} from 'lib/statsig/statsig'
 import {getStarterPackOgCard} from 'lib/strings/starter-pack'
 import {isWeb} from 'platform/detection'
+import {updateProfileShadow} from 'state/cache/profile-shadow'
 import {useModerationOpts} from 'state/preferences/moderation-opts'
-import {RQKEY, useListMembersQuery} from 'state/queries/list-members'
+import {useListMembersQuery} from 'state/queries/list-members'
 import {useResolveDidQuery} from 'state/queries/resolve-uri'
 import {useShortenLink} from 'state/queries/shorten-link'
 import {useStarterPackQuery} from 'state/queries/starter-packs'
@@ -275,10 +277,14 @@ function Header({
         .filter(li => !li.subject.viewer?.following)
         .map(li => li.subject.did)
 
-      await bulkWriteFollows(agent, dids)
+      const followUris = await bulkWriteFollows(agent, dids)
 
-      await queryClient.refetchQueries({
-        queryKey: RQKEY(starterPack.list.uri),
+      batchedUpdates(() => {
+        for (let did of dids) {
+          updateProfileShadow(queryClient, did, {
+            followingUri: followUris.get(did),
+          })
+        }
       })
 
       logEvent('starterPack:followAll', {