fix: migration des onglets singleton → PaneTabManager au split
CI / lint (push) Failing after 13s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / e2e (push) Has been skipped
CI / security (push) Successful in 15s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled

_buildGrid: quand on passe de single-pane à multi-pane, migre les onglets
du TabManager singleton vers le PaneTabManager du pane 0.
Sans ça, transferTab() ne trouvait pas l'onglet (il était resté dans le singleton).

_collapseToSingle: migration inverse (PaneTabManager → singleton)
quand on ferme le dernier split.
This commit is contained in:
2026-07-27 23:34:06 -04:00
parent 4deb54b3a3
commit ed5cf597f9
+38
View File
@@ -700,6 +700,30 @@ const PaneManager = {
}
this.activePaneId = 0;
this._highlightActive();
// Migrate tabs from singleton TabManager to pane-0 PaneTabManager
// (the singleton managed all tabs in single-pane mode)
if (!savedPanes && window._singletonTabManager && window._singletonTabManager._tabs.length > 0) {
const stm = window._singletonTabManager;
const ptm = this.tabManagers[0];
if (ptm && ptm._tabs.length === 0) {
console.log('[PaneManager] migrating', stm._tabs.length, 'tabs from singleton to pane-0');
ptm._tabs = stm._tabs.map(t => ({ ...t }));
ptm._tabCache = { ...stm._tabCache };
ptm._activeTabId = stm._activeTabId;
ptm._previewTabId = stm._previewTabId;
// Clear singleton — it now delegates to PaneManager
stm._tabs = [];
stm._tabCache = {};
stm._activeTabId = null;
stm._previewTabId = null;
// Render the migrated tabs
setTimeout(() => {
ptm._renderTabs();
if (ptm._activeTabId) ptm.activate(ptm._activeTabId);
}, 100);
}
}
},
_createPane(idx, grid, reuseTabBar, reuseContent) {
@@ -901,6 +925,20 @@ const PaneManager = {
if (content) { content.id = 'content-area'; wrapper.appendChild(content); }
const tl = wrapper.querySelector('.tab-list');
if (tl) tl.id = 'tab-list';
// Migrate tabs back to singleton TabManager
const ptm = this.tabManagers[0];
if (ptm && window._singletonTabManager) {
const stm = window._singletonTabManager;
stm._tabs = ptm._tabs.map(t => ({ ...t }));
stm._tabCache = { ...ptm._tabCache };
stm._activeTabId = ptm._activeTabId;
stm._previewTabId = ptm._previewTabId;
stm._tabBar = tabBar;
stm._tabList = tl;
stm._renderTabs();
}
// Re-init pane-0 TabManager to point to restored DOM
if (this.tabManagers[0]) {
this.tabManagers[0]._tabBar = tabBar;