Files
paseo/packages/app/src/hooks/use-directory-demand.ts
T
Mohamed Boudra 428ef707ad fix(app): demand the host directory from the workspace route (#7918)
A workspace restored at launch with no open chat had nothing demanding its host's directory on a phone, so the deck waited on hydration that never started. The workspace route now keeps its host's directory demanded while mounted, through the same hook the agent route uses.
2026-10-26 15:46:10 +07:00

17 lines
659 B
TypeScript

import { useEffect } from "react";
import { getHostRuntimeStore } from "@/runtime/host-runtime";
/**
* Keeps a host's directory demanded while the caller is mounted.
*
* The sidebar only demands the directory while its panel is active, so a compact app that
* restores straight into a workspace or agent route has nothing else asking the host for
* workspaces and agents. Without demand the route waits on hydration that never starts.
*/
export function useDirectoryDemand(serverId: string | null | undefined): void {
useEffect(() => {
if (!serverId) return;
return getHostRuntimeStore().acquireDirectoryDemand(serverId);
}, [serverId]);
}