From 6f52873b690482988cc0bc7fe5f8f459965231f2 Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 13 Oct 2026 21:50:55 +0200 Subject: [PATCH] Support assistant: fix the delete-chat confirmation opening twice (panel click handler was added again on every reload) Co-Authored-By: Claude Opus 5.5 --- src/renderer/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer/app.js b/src/renderer/app.js index 24a2f4f..a1f1134 100644 --- a/src/renderer/app.js +++ b/src/renderer/app.js @@ -1887,7 +1887,8 @@ function initAi() { AI.chat = aiChats().find((c) => c.id === e.target.value) || null; aiRender(); }; - p.addEventListener('click', async (e) => { + // onclick statt addEventListener: initAi() läuft bei jedem reload(), sonst doppelte Handler (z. B. zwei Löschdialoge) + p.onclick = async (e) => { const a = e.target.closest('[data-ai]')?.dataset.ai; if (a === 'new') { if (AI.busy) api.call('ai:stop', AI.chat?.id); AI.chat = null; aiRender(); ta.focus(); } if (a === 'del' && AI.chat && await confirmBox(T('Delete chat?'), `“${AI.chat.title}”`, T('Delete'))) { @@ -1907,7 +1908,7 @@ function initAi() { // Nur einfügen, nicht ausführen – der Nutzer prüft und bestätigt mit Enter if (b.dataset.cmd === 'paste' && t?.kind === 'ssh') { t.term.paste(code); t.term.focus(); } else { api.call('clipboard:write', code); toast(b.dataset.cmd === 'paste' ? T('Copied – no terminal tab is active') : T('Copied')); } - }); + }; if ($('#aiPanel').classList.contains('open')) aiRender(); if (AI.init) return; AI.init = true;