diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-05-01 15:16:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-01 15:16:54 +0100 |
commit | 09f3b2ae1474622603a2d5d83ec77811097670b3 (patch) | |
tree | ea3ea7141615c00712ae3bf6686a9bd302ef0700 /src/screens/Messages/Temp/query/query.ts | |
parent | b8d8bec388744c95aa84c955849d2bced45daf11 (diff) | |
download | voidsky-09f3b2ae1474622603a2d5d83ec77811097670b3.tar.zst |
[Clipclops] Improve message list behaviour (#3789)
* improve message list behaviour * replace useAgent with useSession * add explicit types to appease linter
Diffstat (limited to 'src/screens/Messages/Temp/query/query.ts')
-rw-r--r-- | src/screens/Messages/Temp/query/query.ts | 10 |
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) => { |