fix(tiles): a claim that lands mid-drag lets the dragged tile go (#584 merge-time fix)

_onTileAdoptedElsewhere acted only on a tear-off, a pending tear-off or a drag
that just ended. A header drag carries the tile id even when this window has
Detach Tiles off (no tear-off), so another window could dock the tile and its
claim could arrive before this drag ended; the tile then stayed here as well.
The header drag (_draggedTileId) now counts as dragging too.

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:24 +02:00
1 parent 3975089af3
commit 48e91fc1d9
2 files changed
+13 -1

No files matched your search

+3 -1
View File
@@ -3004,7 +3004,9 @@ Object.assign(CodemanApp.prototype, {
*/
_onTileAdoptedElsewhere(sessionId) {
const recent = this._lastTileDrag;
const dragging = this._tileTearOff?.id === sessionId;
// A header drag counts even without a tear-off (Detach Tiles off here): the
// other window can take the tile before this drag ends.
const dragging = this._tileTearOff?.id === sessionId || this._draggedTileId === sessionId;
const pending = this._tileTearOffPending?.id === sessionId;
const justEnded = recent?.id === sessionId && Date.now() - recent.at < TILE_ADOPT_WINDOW_MS;
if (!dragging && !pending && !justEnded) return false;