mirror of
https://github.com/block/buzz.git
synced 2026-11-01 23:11:58 +00:00
perf(search): lazy-load agent data for topbar search
Finding: L7 search dialog-open kind:10100 pull.\n\nKeep message/user search behavior the same, but defer managed-agent and relay-agent queries until the debounced query reaches the existing minimum search length. Opening and closing the dialog without typing no longer triggers agent discovery/network work. Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
This commit is contained in:
committed by
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d
parent
a9f63b7699
commit
d49811f3df
@@ -102,12 +102,19 @@ export function useSearchResults({
|
||||
.slice(0, 5);
|
||||
}, [channelLabels, channels, debouncedQuery]);
|
||||
|
||||
const hasSearchQuery = debouncedQuery.length >= MIN_SEARCH_QUERY_LENGTH;
|
||||
const searchBackedQueriesEnabled = enabled && hasSearchQuery;
|
||||
|
||||
const userSearchQuery = useUserSearchQuery(debouncedQuery, {
|
||||
enabled: enabled && debouncedQuery.length >= MIN_SEARCH_QUERY_LENGTH,
|
||||
enabled: searchBackedQueriesEnabled,
|
||||
limit,
|
||||
});
|
||||
const managedAgentsQuery = useManagedAgentsQuery({ enabled });
|
||||
const relayAgentsQuery = useRelayAgentsQuery({ enabled });
|
||||
const managedAgentsQuery = useManagedAgentsQuery({
|
||||
enabled: searchBackedQueriesEnabled,
|
||||
});
|
||||
const relayAgentsQuery = useRelayAgentsQuery({
|
||||
enabled: searchBackedQueriesEnabled,
|
||||
});
|
||||
const managedAgentPubkeys = React.useMemo(
|
||||
() =>
|
||||
new Set(
|
||||
|
||||
Reference in New Issue
Block a user