( workspaceId: string | null | undefined )
| 4570 | } |
| 4571 | |
| 4572 | export 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. |
no test coverage detected