Files
buzz/desktop/src/features/agents/useManagedAgentRuntimeReconciliation.ts
npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta 8134248e00 fix(desktop): align managed runtime identity contract
Co-authored-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1mprnacetjua2xx3p5eddmhxyk6wv929ymm5py8kd2xfxurxahspqqlgyta <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>

Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
2026-07-19 10:53:35 -04:00

29 lines
900 B
TypeScript

import { useQueryClient } from "@tanstack/react-query";
import * as React from "react";
import { managedAgentRuntimesQueryKey } from "@/features/agents/managedAgentRuntimeHooks";
import { reconcileManagedAgentRuntimes } from "@/shared/api/tauriManagedAgents";
export function useManagedAgentRuntimeReconciliation(
communities: readonly { relayUrl: string }[],
): void {
const queryClient = useQueryClient();
const reconciled = React.useRef(false);
React.useEffect(() => {
if (reconciled.current) return;
reconciled.current = true;
void reconcileManagedAgentRuntimes(communities)
.then((runtimes) => {
queryClient.setQueryData(managedAgentRuntimesQueryKey, runtimes);
})
.catch((error) => {
console.warn(
"[managed-agent-runtimes] startup reconcile failed:",
error,
);
});
}, [communities, queryClient]);
}