Skip to content

Commit 082fd06

Browse files
committed
fix(web): only the active split pane takes pastes, focus, and panel actions
1 parent 67e585c commit 082fd06

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,14 @@ export default function ChatView(props: ChatViewProps) {
21282128

21292129
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- window focus listener that refocuses the composer after the window regains focus
21302130
useEffect(() => {
2131-
if (embedded || !activeThread?.id || terminalUiState.terminalOpen || isMobileViewport) return;
2131+
if (
2132+
embedded ||
2133+
!splitPaneActive ||
2134+
!activeThread?.id ||
2135+
terminalUiState.terminalOpen ||
2136+
isMobileViewport
2137+
)
2138+
return;
21322139
let frame: number | null = null;
21332140
const onWindowFocus = () => {
21342141
if (frame !== null) window.cancelAnimationFrame(frame);
@@ -2156,6 +2163,7 @@ export default function ChatView(props: ChatViewProps) {
21562163
embedded,
21572164
focusComposerStable,
21582165
isMobileViewport,
2166+
splitPaneActive,
21592167
terminalUiState.terminalOpen,
21602168
]);
21612169

@@ -2750,14 +2758,14 @@ export default function ChatView(props: ChatViewProps) {
27502758
// A focused desktop browser page forwards these chords as menu actions.
27512759
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle the right panel
27522760
useEffect(() => {
2753-
if (embedded) return;
2761+
if (embedded || !splitPaneActive) return;
27542762
return window.desktopBridge?.onMenuAction((action) => {
27552763
if (action === "rightPanel.toggle") toggleRightPanelStable();
27562764
else if (action === "rightPanel.toggleMaximized") toggleRightPanelMaximizedStable();
27572765
});
2758-
}, [embedded, toggleRightPanelStable, toggleRightPanelMaximizedStable]);
2766+
}, [embedded, splitPaneActive, toggleRightPanelStable, toggleRightPanelMaximizedStable]);
27592767

2760-
usePasteToFocusComposer(embedded ? null : activeThreadId, composerRef);
2768+
usePasteToFocusComposer(embedded || !splitPaneActive ? null : activeThreadId, composerRef);
27612769
// A delegated task is a remote thread's subagent.
27622770
const isSubagentThread =
27632771
activeThread?.lineage.relationshipToParent === "subagent" || delegatedFrom !== null;

0 commit comments

Comments
 (0)