fix(webui): preserve named pane groups

This commit is contained in:
Xubin Ren
2026-08-29 14:22:19 +08:00
parent 1fe14f2ee6
commit caab883f9f
4 changed files with 136 additions and 7 deletions
@@ -72,9 +72,10 @@ function normalizeTab(value: unknown): WorkbenchTabState {
...requestedLayoutPaneKeys,
...paneKeys.filter((key) => !requestedLayoutPaneKeys.includes(key)),
];
const title = normalizeTitle(candidate.title);
return {
explicit: candidate.explicit === true,
title: normalizeTitle(candidate.title),
explicit: candidate.explicit === true || title !== null,
title,
paneKeys,
layoutPaneKeys,
layout: isLayout(candidate.layout) ? candidate.layout : "columns",
@@ -309,7 +310,9 @@ export function renameWorkbenchTab(
const normalized = normalizeTitle(title);
if (!normalized) return state;
return updateTab(state, tabKey, (tab) => (
tab.title === normalized ? tab : { ...tab, title: normalized }
tab.title === normalized && tab.explicit
? tab
: { ...tab, explicit: true, title: normalized }
));
}