shellphone.app/app/messages/hooks/use-conversation.ts
2021-08-01 18:36:32 +08:00

21 lines
384 B
TypeScript

import { useQuery } from "blitz";
import getConversationsQuery from "../queries/get-conversations";
export default function useConversation(recipient: string) {
return useQuery(
getConversationsQuery,
{},
{
select(conversations) {
if (!conversations[recipient]) {
return [];
}
return conversations[recipient]!;
},
keepPreviousData: true,
}
);
}