Fix display names flashing to pubkeys when loading older messages (#1137)

Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
Co-authored-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Tyler
2026-06-19 10:43:01 -04:00
committed by GitHub
parent aeafb0b0b2
commit c448f1c729

View File

@@ -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,
@@ -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,
});