mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 00:02:37 +00:00
fix(native-chat): keep chat visible when detaching its pane (#23096)
* fix(native-chat): persist current pane ownership across lifecycle events * fix(native-chat): retain ownership when client chat rendering is disabled * fix(native-chat): preserve chat mode when detaching its pane --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
This commit is contained in:
@@ -271,6 +271,31 @@ describe('resolveTerminalTabStripDropTarget', () => {
|
||||
})
|
||||
|
||||
describe('detachTerminalPaneToTab', () => {
|
||||
it.each([LEAF_1, LEAF_2])('moves chat mode only with its owning leaf %s', (chatLeafId) => {
|
||||
const store = createStore({ ...splitLayout(), chatLeafId })
|
||||
detachTerminalPaneToTab({
|
||||
getStore: () => store,
|
||||
manager: {
|
||||
getPanes: () => [{ id: 1 }, { id: 2 }],
|
||||
getLeafId: () => LEAF_2,
|
||||
detachPaneForExternalMove: () => true
|
||||
},
|
||||
persistLayoutSnapshot: vi.fn(),
|
||||
sourcePaneId: 2,
|
||||
sourceTabId: SOURCE_TAB_ID,
|
||||
targetGroupId: TARGET_GROUP_ID,
|
||||
worktreeId: WORKTREE_ID
|
||||
})
|
||||
const options = vi.mocked(store.createTab).mock.calls[0]?.[3]
|
||||
expect(options?.viewMode ?? 'terminal').toBe(chatLeafId === LEAF_2 ? 'chat' : 'terminal')
|
||||
expect(store.terminalLayoutsByTabId['tab-detached']?.chatLeafId).toBe(
|
||||
chatLeafId === LEAF_2 ? LEAF_2 : undefined
|
||||
)
|
||||
expect(store.terminalLayoutsByTabId[SOURCE_TAB_ID]?.chatLeafId).toBe(
|
||||
chatLeafId === LEAF_1 ? LEAF_1 : undefined
|
||||
)
|
||||
})
|
||||
|
||||
it('creates a new terminal tab with the detached leaf layout and PTY id', () => {
|
||||
const store = createStore()
|
||||
const manager = {
|
||||
|
||||
@@ -140,6 +140,7 @@ export function detachTerminalPaneToTab(args: {
|
||||
)?.shellOverride
|
||||
const tab = latestStore.createTab(args.worktreeId, args.targetGroupId, sourceShellOverride, {
|
||||
activate: true,
|
||||
...(detachedLayout.chatLeafId ? { viewMode: 'chat' as const } : {}),
|
||||
initialPtyId: ptyId ?? undefined,
|
||||
...(!ptyId
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user