From c448f1c72966b045f7d9b84560b3c1d04ca8b72c Mon Sep 17 00:00:00 2001 From: Tyler <109685178+tlongwell-block@users.noreply.github.com> Date: Fri, 19 Jun 2026 10:43:01 -0400 Subject: [PATCH] Fix display names flashing to pubkeys when loading older messages (#1137) Signed-off-by: Tyler Longwell Co-authored-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 --- desktop/src/features/profile/hooks.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/desktop/src/features/profile/hooks.ts b/desktop/src/features/profile/hooks.ts index 9f1eca8bf0..4c4f86143b 100644 --- a/desktop/src/features/profile/hooks.ts +++ b/desktop/src/features/profile/hooks.ts @@ -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, });