Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion desktop/src/features/profile/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import * as React from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import {
keepPreviousData,
useMutation,
useQuery,
useQueryClient,
} from "@tanstack/react-query";

import {
getProfile,
Expand Down Expand Up @@ -281,6 +286,10 @@ export function useUsersBatchQuery(
enabled,
queryKey: ["users-batch", ...normalizedPubkeys],
queryFn: () => getUsersBatch(normalizedPubkeys),
// Loading older messages grows the pubkey set, which changes this query's
// key entirely. Without this, already-resolved authors would flash back
// to their raw pubkey while the larger batch refetches.
placeholderData: keepPreviousData,
staleTime: 60_000,
gcTime: 5 * 60 * 1_000,
});
Expand Down