MCPcopy
hub / github.com/coder/mux / useOptionalWorkspaceSidebarState

Function useOptionalWorkspaceSidebarState

src/browser/stores/WorkspaceStore.ts:4572–4592  ·  view source on GitHub ↗
(
  workspaceId: string | null | undefined
)

Source from the content-addressed store, hash-verified

4570}
4571
4572export function useOptionalWorkspaceSidebarState(
4573 workspaceId: string | null | undefined
4574): WorkspaceSidebarState | null {
4575 const store = getStoreInstance();
4576 const id = workspaceId ?? "";
4577
4578 return useSyncExternalStore(
4579 (listener) => {
4580 if (!store.hasRegisteredWorkspace(id)) {
4581 return () => undefined;
4582 }
4583 return store.subscribeKey(id, listener);
4584 },
4585 () => {
4586 if (!store.hasRegisteredWorkspace(id)) {
4587 return null;
4588 }
4589 return store.getWorkspaceSidebarState(id);
4590 }
4591 );
4592}
4593
4594/**
4595 * Hook to get UI-only live stdout/stderr for a running bash tool call.

Callers 5

ChatInputInnerFunction · 0.90
CompleteGoalToolCallFunction · 0.90
RightSidebarComponentFunction · 0.90
GoalTabLabelFunction · 0.90
WorkflowsTabLabelFunction · 0.90

Calls 4

subscribeKeyMethod · 0.80
getStoreInstanceFunction · 0.70

Tested by

no test coverage detected