mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
fix(desktop): refresh the agent-template catalog on inbound relay sync
The agent-templates query pins staleTime: Infinity, so a saved template created, edited, or tombstoned on another device never reached the New Agent catalog until app restart. Invalidate agentTemplatesQueryKey in the agents-data-changed listener alongside the other relay-backed queries. Co-authored-by: Taylor Ho <taylorkmho@gmail.com> Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
co-authored by
Taylor Ho
parent
28ca228e19
commit
99534b5d6f
@@ -3,6 +3,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import {
|
||||
agentTemplatesQueryKey,
|
||||
managedAgentsQueryKey,
|
||||
personasQueryKey,
|
||||
relayAgentsQueryKey,
|
||||
@@ -34,6 +35,13 @@ export function useAgentsDataRefresh(): void {
|
||||
void queryClient.invalidateQueries({ queryKey: teamsQueryKey });
|
||||
void queryClient.invalidateQueries({ queryKey: managedAgentsQueryKey });
|
||||
void queryClient.invalidateQueries({ queryKey: relayAgentsQueryKey });
|
||||
// Saved templates are persona records, so an inbound persona
|
||||
// upsert/tombstone from another device changes the New Agent
|
||||
// catalog too. Without this line the catalog query (staleTime:
|
||||
// Infinity) would serve the pre-sync list forever.
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: agentTemplatesQueryKey,
|
||||
});
|
||||
}, COALESCE_MS);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user