about summary refs log tree commit diff
path: root/src/screens/Messages/Temp/query/query.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens/Messages/Temp/query/query.ts')
-rw-r--r--src/screens/Messages/Temp/query/query.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/screens/Messages/Temp/query/query.ts b/src/screens/Messages/Temp/query/query.ts
index a4d78e0bb..02f31c029 100644
--- a/src/screens/Messages/Temp/query/query.ts
+++ b/src/screens/Messages/Temp/query/query.ts
@@ -5,7 +5,7 @@ import {
   useQueryClient,
 } from '@tanstack/react-query'
 
-import {useAgent} from '#/state/session'
+import {useSession} from '#/state/session'
 import * as TempDmChatDefs from '#/temp/dm/defs'
 import * as TempDmChatGetChat from '#/temp/dm/getChat'
 import * as TempDmChatGetChatForMembers from '#/temp/dm/getChatForMembers'
@@ -20,10 +20,10 @@ import {useDmServiceUrlStorage} from '../useDmServiceUrlStorage'
  */
 
 const useHeaders = () => {
-  const {getAgent} = useAgent()
+  const {currentAccount} = useSession()
   return {
     get Authorization() {
-      return getAgent().session!.did
+      return currentAccount!.did
     },
   }
 }
@@ -196,6 +196,10 @@ export function useChatLogQuery() {
         const json =
           (await response.json()) as TempDmChatGetChatLog.OutputSchema
 
+        if (json.logs.length > 0) {
+          queryClient.invalidateQueries({queryKey: ['chats']})
+        }
+
         for (const log of json.logs) {
           if (TempDmChatDefs.isLogCreateMessage(log)) {
             queryClient.setQueryData(['chat', log.chatId], (prev: Chat) => {