fix(ui): 浮窗内 tab 的 visible 恒为 true,不再跟随面板开合
renderTab 的可见性原为 panelOpen && active——浮窗内容随侧边栏收起被判定为 不可见,遵守 visible 契约(不可见时暂停/空渲染)的消费插件 tab 会在浮窗里 白屏。改为 placement 三态(top/bottom/float),float 恒 true(兑现 AGENTS §7.5 契约);回归测试断言面板收起后浮窗内的注册插件 tab 仍收到 visible=true。
This commit is contained in:
+16
-4
@@ -1191,7 +1191,13 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
* polling while the page is not actually visible). The pane id travels
|
||||
* with the tab so diff tabs can split below their source pane.
|
||||
*/
|
||||
const renderTab = (tab: SidebarTab, active: boolean, paneId: string, bottom = false) => (
|
||||
// `placement` decides the visibility contract handed to the tab component:
|
||||
// pane tabs are visible while their panel is open and they are active, but
|
||||
// a free window is its own surface — its tab stays visible no matter what
|
||||
// the panels do (the AGENTS §7.5 contract; plugin components honor
|
||||
// `visible` to pause work, so tying floats to panelOpen would blank them
|
||||
// the moment the sidebar collapses).
|
||||
const renderTab = (tab: SidebarTab, active: boolean, paneId: string, placement: 'top' | 'bottom' | 'float' = 'top') => (
|
||||
<TabContent
|
||||
tab={tab}
|
||||
paneId={paneId}
|
||||
@@ -1202,7 +1208,13 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
onReferenceFile={referenceInChat}
|
||||
ctx={ctx}
|
||||
store={store}
|
||||
visible={bottom ? state.bottomOpen && active : state.panelOpen && active}
|
||||
visible={
|
||||
placement === 'float'
|
||||
? true
|
||||
: placement === 'bottom'
|
||||
? state.bottomOpen && active
|
||||
: state.panelOpen && active
|
||||
}
|
||||
onSubagentJump={(childSessionId) => { subagentJumpRef.current = childSessionId }}
|
||||
onOpenDiff={(diffTab) => { store.reduce(s => openDiffTab(s, paneId, diffTab)) }}
|
||||
localeRevision={localeRevision}
|
||||
@@ -1469,7 +1481,7 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
newTabOptions={buildNewTabOptions(state, ctx, { sessionId, cwd })}
|
||||
actions={actions}
|
||||
onNewTab={onNewTab}
|
||||
renderTab={(tab, active, paneId) => renderTab(tab, active, paneId, true)}
|
||||
renderTab={(tab, active, paneId) => renderTab(tab, active, paneId, 'bottom')}
|
||||
getTabIcon={tabIconOf}
|
||||
getTabBadge={tabBadgeOf}
|
||||
/>
|
||||
@@ -1488,7 +1500,7 @@ export function Sidebar(props: { ctx: Context; store: SidebarStore }) {
|
||||
<FreeWindow
|
||||
key={float.id}
|
||||
float={float}
|
||||
renderTab={renderTab}
|
||||
renderTab={(tab, active, paneId) => renderTab(tab, active, paneId, 'float')}
|
||||
getTabIcon={tabIconOf}
|
||||
onRaise={() => { store.reduce(s => raiseFloat(s, float.id)) }}
|
||||
onMove={(x, y) => { store.reduce(s => moveFloat(s, float.id, x, y)) }}
|
||||
|
||||
Reference in New Issue
Block a user