mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 01:09:43 +02:00
fix(ui): only show 'session renamed' toast when name actually changes
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+19
-13
@@ -1467,22 +1467,28 @@ class ClaudemanApp {
|
|||||||
async saveSessionOptions() {
|
async saveSessionOptions() {
|
||||||
if (!this.editingSessionId) return;
|
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 {
|
// Only update if name actually changed
|
||||||
const res = await fetch(`/api/sessions/${this.editingSessionId}/name`, {
|
if (newName !== oldName) {
|
||||||
method: 'PUT',
|
try {
|
||||||
headers: { 'Content-Type': 'application/json' },
|
const res = await fetch(`/api/sessions/${this.editingSessionId}/name`, {
|
||||||
body: JSON.stringify({ name })
|
method: 'PUT',
|
||||||
});
|
headers: { 'Content-Type': 'application/json' },
|
||||||
const data = await res.json();
|
body: JSON.stringify({ name: newName })
|
||||||
if (data.error) throw new Error(data.error);
|
});
|
||||||
|
const data = await res.json();
|
||||||
|
if (data.error) throw new Error(data.error);
|
||||||
|
|
||||||
this.showToast('Session renamed', 'success');
|
this.showToast('Session renamed', 'success');
|
||||||
this.closeSessionOptions();
|
} catch (err) {
|
||||||
} catch (err) {
|
this.showToast('Failed to rename: ' + err.message, 'error');
|
||||||
this.showToast('Failed to rename: ' + err.message, 'error');
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.closeSessionOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inline rename on right-click
|
// Inline rename on right-click
|
||||||
|
|||||||
Reference in New Issue
Block a user