mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-01 14:12:51 +00:00
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>
36 lines
1018 B
TypeScript
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;
|
|
}
|