Files
paseo/packages/app/src/data/provider-icons.ts
T
Mohamed Boudra ad56659a89 fix(app): resolve plugin provider icons after the snapshot arrives (#5720)
Subscribe icon consumers to snapshot SVG metadata so compiler-cached fallbacks update when provider discovery completes.
2026-09-30 13:46:43 +01:00

18 lines
640 B
TypeScript

import type { ProviderSnapshotEntry } from "@getpaseo/protocol/agent-types";
import { createStore } from "zustand/vanilla";
export const providerSnapshotIcons = createStore<ReadonlyMap<string, ReadonlyMap<string, string>>>(
() => new Map(),
);
export function replaceProviderSnapshotIcons(
serverId: string,
entries: readonly Pick<ProviderSnapshotEntry, "provider" | "iconSvg">[],
): void {
const icons = new Map<string, string>();
for (const entry of entries) {
if (entry.iconSvg) icons.set(entry.provider, entry.iconSvg);
}
providerSnapshotIcons.setState((previous) => new Map(previous).set(serverId, icons), true);
}