Files
paseo/packages/app/src/plugins/catalog-sync.tsx
T
8e7e8cce21 fix(app): retain plugin state across host disconnects (#8105)
Keep client plugin installations and local UI state alive through transient host disconnects. Reconcile changed bundles and removals on reconnect and refresh settings changed while offline. Connection switching still replaces the client and reinstalls plugins.

Preserves the implementation from #6731, adds a failing-before/passing-after real browser regression, and corrects the English and Chinese lifecycle documentation. Verified with focused tests, browser reconnect journeys, Android debug offline interaction, root checks and green current-head CI.

Co-authored-by: luke <luopeihuan@gmail.com>
Co-authored-by: RoundRedDot <roundreddot@gmail.com>
2026-10-28 15:55:32 +07:00

36 lines
1018 B
TypeScript

import { useVoiceAudioEngineOptional } from "@/contexts/voice-context";
import { useEffect } from "react";
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
import { useHostFeature } from "@/runtime/host-features";
import { useHostRuntimeIsConnected } from "@/runtime/host-runtime";
import { pluginRegistry } from "./registry";
import { syncPluginCatalog } from "./catalog-sync-model";
export function PluginCatalogSync({
serverId,
client,
}: {
serverId: string;
client: DaemonClient;
}) {
const audio = useVoiceAudioEngineOptional();
const connected = useHostRuntimeIsConnected(serverId);
const supported = useHostFeature(serverId, "plugins");
useEffect(
() =>
syncPluginCatalog({
serverId,
client,
audio,
connected,
supported,
registry: pluginRegistry,
}),
[audio, client, connected, serverId, supported],
);
useEffect(() => () => pluginRegistry.removeHost(serverId), [serverId]);
return null;
}