From 17a53c4da28926956c5120458984a89dee60d037 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 19 Jan 2026 15:06:41 +0100 Subject: [PATCH] fix(ui): only show 'session renamed' toast when name actually changes Co-Authored-By: Claude Opus 4.5 --- src/web/public/app.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/web/public/app.js b/src/web/public/app.js index 52032860..f58fda79 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -1467,22 +1467,28 @@ class ClaudemanApp { async saveSessionOptions() { if (!this.editingSessionId) return; - const name = document.getElementById('sessionNameInput').value.trim(); + const session = this.sessions.get(this.editingSessionId); + const newName = document.getElementById('sessionNameInput').value.trim(); + const oldName = session?.name || ''; - try { - const res = await fetch(`/api/sessions/${this.editingSessionId}/name`, { - method: 'PUT', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ name }) - }); - const data = await res.json(); - if (data.error) throw new Error(data.error); + // Only update if name actually changed + if (newName !== oldName) { + try { + const res = await fetch(`/api/sessions/${this.editingSessionId}/name`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ name: newName }) + }); + const data = await res.json(); + if (data.error) throw new Error(data.error); - this.showToast('Session renamed', 'success'); - this.closeSessionOptions(); - } catch (err) { - this.showToast('Failed to rename: ' + err.message, 'error'); + this.showToast('Session renamed', 'success'); + } catch (err) { + this.showToast('Failed to rename: ' + err.message, 'error'); + } } + + this.closeSessionOptions(); } // Inline rename on right-click