From 11326764e7cd24fa6234549eaecd2a2ba1ea3273 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Wed, 15 Apr 2026 18:33:43 -0700 Subject: [PATCH] fix: remove dead sessions variable and add committed guard to prevent double-commit in commitRename - Remove unused 'sessions' variable in renderViewsSettingsTab() forEach loop (was declared but never used; sessionCount already derived from view.sessions directly) - Add 'committed' flag to commitRename() closure to prevent duplicate PATCH requests when Enter-triggered DOM teardown fires blur on the still-live input (pattern mirrors the 150ms guard already used in showNewViewInput()) --- muxplex/frontend/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/muxplex/frontend/app.js b/muxplex/frontend/app.js index 2e07626..24f45f2 100644 --- a/muxplex/frontend/app.js +++ b/muxplex/frontend/app.js @@ -1019,8 +1019,6 @@ function renderViewsSettingsTab() { // Build the list of view rows listEl.innerHTML = ''; views.forEach(function(view, idx) { - var sessions = (_serverSettings && _serverSettings.sessions) || []; - // Count sessions that belong to this view var viewSessions = view.sessions || []; var sessionCount = viewSessions.length; @@ -1177,7 +1175,9 @@ function renderViewsSettingsTab() { input.focus(); input.select(); + var committed = false; function commitRename() { + if (committed) return; var newName = input.value.trim(); if (!newName || newName === currentName) { renderViewsSettingsTab(); @@ -1197,6 +1197,7 @@ function renderViewsSettingsTab() { return; } // Update the view name + committed = true; var updated = views.map(function(v, i) { return i === idx ? Object.assign({}, v, { name: newName }) : v; });