Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/web/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,8 @@ class CodemanApp {
// ═══════════════════════════════════════════════════════════════

renderSessionTabs() {
// Don't re-render while user is typing in the inline rename input
if (this._inlineRenameActive) return;
this._debouncedCall('sessionTabs', this._renderSessionTabsImmediate);
}

Expand Down Expand Up @@ -1988,6 +1990,7 @@ class CodemanApp {
}

_fullRenderSessionTabs() {
if (this._inlineRenameActive) return;
const container = this.$('sessionTabs');

// Clean up any orphaned dropdowns before re-rendering
Expand Down
10 changes: 9 additions & 1 deletion src/web/public/session-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,11 +912,15 @@ Object.assign(CodemanApp.prototype, {
const tabName = document.querySelector(`.tab-name[data-session-id="${sessionId}"]`);
if (!tabName) return;

// Prevent tab re-renders from destroying the input while renaming
this._inlineRenameActive = true;

const currentName = this.getSessionName(session);
const parsed = parseSessionPrefix(session.name);
const originalContent = tabName.textContent;
// Clear existing content to make room for the input element
tabName.textContent = '';
tabName.innerHTML = '';
while (tabName.firstChild) tabName.removeChild(tabName.firstChild);

// If prefix detected, show it as non-editable label
if (parsed) {
Expand All @@ -938,6 +942,8 @@ Object.assign(CodemanApp.prototype, {
input.select();

const finishRename = async () => {
if (!this._inlineRenameActive) return; // prevent double-fire
this._inlineRenameActive = false;
const suffix = input.value.trim();
let fullName;
if (parsed) {
Expand All @@ -959,6 +965,8 @@ Object.assign(CodemanApp.prototype, {
this.showToast('Failed to rename', 'error');
}
}
// Re-render tabs to restore full tab structure
this.renderSessionTabs();
};

input.addEventListener('blur', finishRename);
Expand Down