(workspaceState: WorkspaceState)
| 12 | } |
| 13 | |
| 14 | export function useWatchedSessionSync(workspaceState: WorkspaceState) { |
| 15 | useEffect(() => { |
| 16 | if (!window.piDesktop?.watchSession) { |
| 17 | return |
| 18 | } |
| 19 | |
| 20 | const watchedSessionPath = |
| 21 | workspaceState.activeView === 'chat' || |
| 22 | workspaceState.activeView === 'thread' || |
| 23 | workspaceState.activeView === 'gitops' |
| 24 | ? getPersistedSessionPath(workspaceState.selectedSessionPath) |
| 25 | : null |
| 26 | |
| 27 | void window.piDesktop.watchSession(watchedSessionPath).catch((error) => { |
| 28 | console.warn('Failed to update watched Pi session.', error) |
| 29 | }) |
| 30 | }, [workspaceState.activeView, workspaceState.selectedSessionPath]) |
| 31 | } |
| 32 | |
| 33 | export function useUtilityViewEscape({ |
| 34 | activeView, |
no test coverage detected