Skip to content

Commit e92605a

Browse files
fix(ui): preserve projected panel closure
1 parent 00b9ce1 commit e92605a

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎ui/src/pages/chat/chat-pane-sidebar-layout.test.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,22 @@ describe("chat pane sidebar layout", () => {
197197
}
198198
});
199199

200-
it("preserves owner visibility when Board chat is removed from the projection", () => {
200+
it("closes an empty Board projection and preserves visibility with a real tab", () => {
201201
for (const open of [true, false]) {
202-
const layout = resolveSidebarLayoutForBoard({
202+
const empty = resolveSidebarLayoutForBoard({
203203
board: board("hidden", "chat"),
204204
layout: { ...openSlot({ columns: [] }, "chat"), open },
205205
paneWidth: 1_400,
206206
});
207-
expect(layout.columns).toEqual([]);
208-
expect(layout.open).toBe(open);
207+
expect(empty).toMatchObject({ columns: [], open: false });
208+
209+
const withDetail = resolveSidebarLayoutForBoard({
210+
board: board("hidden", "chat"),
211+
layout: { ...openSlot(openSlot({ columns: [] }, "chat"), "detail"), open },
212+
paneWidth: 1_400,
213+
});
214+
expect(withDetail.columns[0]?.panels.map((panel) => panel.slot)).toEqual(["detail"]);
215+
expect(withDetail.open).toBe(open);
209216
}
210217
});
211218

‎ui/src/pages/chat/chat-pane-sidebar-layout.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ export function resolveSidebarLayoutForBoard(params: {
198198
if (!chatSide) {
199199
const open = layout.open;
200200
layout = closeSlot(layout, "chat");
201-
layout = { ...layout, open };
201+
if (layout.columns.length > 0) {
202+
layout = { ...layout, open };
203+
}
202204
return fitSidebarLayout(layout, params.paneWidth) ?? layout;
203205
}
204206
const explicitlyClosed = layout.columns.length > 0 && layout.open === false;

0 commit comments

Comments
 (0)