fix(tiles): docking a tile asks any pop-out of that session to close (#584 merge-time fix)

_dockForeignTile posted close-request only when this window knew the session
was popped out. A pop-out opened from another dashboard window was not in this
window's detachedSessions, so it stayed open beside the newly docked tile and
two views sized one PTY. The request now goes out for every docked id;
dashboards ignore it and only that session's pop-out reacts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-13 18:59:39 +02:00
1 parent 48e91fc1d9
commit 63ac10dcc0
2 files changed
+12 -1

No files matched your search

+4 -1
View File
@@ -2980,7 +2980,10 @@ Object.assign(CodemanApp.prototype, {
place(sessionId); place(sessionId);
if (!grid.has(sessionId)) return false; if (!grid.has(sessionId)) return false;
(this._tileDockedAt ||= new Map()).set(sessionId, Date.now()); (this._tileDockedAt ||= new Map()).set(sessionId, Date.now());
if (poppedOut) this._postWindowMessage?.({ type: 'close-request', id: sessionId }); // Asked unconditionally: a pop-out this window never heard of (opened from
// another dashboard) closes too. Dashboards ignore it; only that id's
// pop-out reacts.
this._postWindowMessage?.({ type: 'close-request', id: sessionId });
this._postWindowMessage?.({ type: 'tile-adopted', id: sessionId, by: this._wsTabNonce }); this._postWindowMessage?.({ type: 'tile-adopted', id: sessionId, by: this._wsTabNonce });
return true; return true;
}, },
+8
View File
@@ -387,6 +387,14 @@ describe('a tile from another window dropped here', () => {
expect(app._tileGrid.ids).toContain('s-other'); expect(app._tileGrid.ids).toContain('s-other');
}); });
it("asks the session's pop-out to close even when this window did not know of one", () => {
// Popped out from another dashboard: this window's detachedSessions never had it.
const app = openGrid(THREE);
tileEl('s-c').dispatch('drop', foreign('s-other'));
expect(app._tileGrid.ids).toContain('s-other');
expect(app._postWindowMessage).toHaveBeenCalledWith({ type: 'close-request', id: 's-other' });
});
it('an id this page does not know docks nowhere', () => { it('an id this page does not know docks nowhere', () => {
const app = openGrid(THREE); const app = openGrid(THREE);
tileEl('s-b').dispatch('drop', foreign('s-gone')); tileEl('s-b').dispatch('drop', foreign('s-gone'));