MCPcopy Create free account
hub / github.com/block/buzz / useCreateManagedAgentMutation

Function useCreateManagedAgentMutation

desktop/src/features/agents/hooks.ts:231–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229}
230
231export function useCreateManagedAgentMutation() {
232 const queryClient = useQueryClient();
233
234 return useMutation({
235 mutationFn: (input: CreateManagedAgentInput) => createManagedAgent(input),
236 onSuccess: (created) => {
237 queryClient.setQueryData<ManagedAgent[]>(
238 managedAgentsQueryKey,
239 (current) => {
240 const next = current ?? [];
241
242 return [
243 created.agent,
244 ...next.filter((agent) => agent.pubkey !== created.agent.pubkey),
245 ];
246 },
247 );
248 },
249 onSettled: async () => {
250 await queryClient.invalidateQueries({ queryKey: managedAgentsQueryKey });
251 await queryClient.invalidateQueries({ queryKey: relayAgentsQueryKey });
252 },
253 });
254}
255
256export function useUpdateManagedAgentMutation() {
257 const queryClient = useQueryClient();

Callers 4

UserProfilePanelFunction · 0.90
CreateAgentDialogFunction · 0.90
usePersonaActionsFunction · 0.90
useManagedAgentActionsFunction · 0.90

Calls 1

createManagedAgentFunction · 0.90

Tested by

no test coverage detected