about summary refs log tree commit diff
path: root/src/state/queries/messages/leave-conversation.ts
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-10 08:46:51 -0700
committerGitHub <noreply@github.com>2024-05-10 08:46:51 -0700
commitf928e0a54736803a8650c084b5a0977ff1881ecf (patch)
treec9675d304e3bc30a3148f8a164f07b4662d9e1ae /src/state/queries/messages/leave-conversation.ts
parent8f56f79c6c94a7adf1de304097067f5aed0a111a (diff)
downloadvoidsky-f928e0a54736803a8650c084b5a0977ff1881ecf.tar.zst
[🐴] Mutate data instead of invalidating queries when muting or unmuting (#3946)
* mutate for mutes

* mutate data for mutes

* add initial data, `useConvoQuery` in `ConvoMenu`

* `useInitialData`

* don't use `identifier` for notifications, use `dates` instead

* better implementation

* simplify

* simplify

* fix types
Diffstat (limited to 'src/state/queries/messages/leave-conversation.ts')
-rw-r--r--src/state/queries/messages/leave-conversation.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/state/queries/messages/leave-conversation.ts b/src/state/queries/messages/leave-conversation.ts
index 0dd67fa0b..5d5c64c5b 100644
--- a/src/state/queries/messages/leave-conversation.ts
+++ b/src/state/queries/messages/leave-conversation.ts
@@ -11,7 +11,7 @@ import {RQKEY as CONVO_LIST_KEY} from './list-converations'
 import {useHeaders} from './temp-headers'
 
 export function useLeaveConvo(
-  convoId: string,
+  convoId: string | undefined,
   {
     onSuccess,
     onError,
@@ -26,6 +26,8 @@ export function useLeaveConvo(
 
   return useMutation({
     mutationFn: async () => {
+      if (!convoId) throw new Error('No convoId provided')
+
       const agent = new BskyAgent({service: serviceUrl})
       const {data} = await agent.api.chat.bsky.convo.leaveConvo(
         {convoId},
@@ -41,7 +43,6 @@ export function useLeaveConvo(
           pageParams: Array<string | undefined>
           pages: Array<ChatBskyConvoListConvos.OutputSchema>
         }) => {
-          console.log('old', old)
           if (!old) return old
           return {
             ...old,