mirror of
https://github.com/block/buzz.git
synced 2026-10-30 05:51:46 +00:00
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:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user