fix(tiles): a tile docked in another window leaves this window's stored grid alone (#584 merge-time fix)

There is one stored grid per browser (codeman:tile-grid), and the window that
docked the tile has just written it. When this window then hears the claim and
drops the tile, removeTile (or, for its last tile, closeTileGrid with
keepStored: false) overwrote or forgot that stored grid. The removal now runs
under _tilePersistHold, and the last-tile close keeps the stored grid.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-13 18:58:22 +02:00
1 parent 9ad43fbd88
commit 3975089af3
2 files changed
+45 -2

No files matched your search

+10 -2
View File
@@ -3012,8 +3012,16 @@ Object.assign(CodemanApp.prototype, {
this._lastTileDrag = null;
const grid = this._tileGrid;
if (!grid?.has(sessionId)) return false;
if (grid.ids.length > 1) return this.removeTile(sessionId, { focus: false });
this.closeTileGrid({ keepStored: false, reselect: false });
// One stored grid per browser, and the window that docked the tile has
// just written it: this window losing the tile is no change of the
// user's to remember over that one (nor to forget it).
this._tilePersistHold = true;
try {
if (grid.ids.length > 1) return this.removeTile(sessionId, { focus: false });
this.closeTileGrid({ keepStored: true, reselect: false });
} finally {
this._tilePersistHold = false;
}
this.activeSessionId = null;
try {
localStorage.removeItem('codeman-active-session');