From bbdd4cbc7866ed36c11375c6d09e17d7f8df6f71 Mon Sep 17 00:00:00 2001 From: saopig1 <4x7sw862st@gmail.com> Date: Tue, 16 Jun 2026 14:45:01 +0800 Subject: [PATCH] fix(autopause): decouple auto-pause toggle from idle-timeout save [#81 review] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The checkbox @change was wired to saveIdleTimeout, which POSTed BOTH idleTimeoutMinutes and autoPauseOnEmpty: toggling silently committed an unsaved idle edit, and an empty/ non-numeric idle field made the combined POST 400 (errors swallowed), leaving the checkbox flipped but not persisted. Give the toggle its own saveAutoPause() sending only the boolean; 保存 now sends only idleTimeoutMinutes. --- web/src/views/Settings.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/web/src/views/Settings.vue b/web/src/views/Settings.vue index ea0af56..2e9f887 100755 --- a/web/src/views/Settings.vue +++ b/web/src/views/Settings.vue @@ -442,7 +442,7 @@ v-model="autoPauseOnEmpty" type="checkbox" class="profile-toggle-switch" - @change="saveIdleTimeout" + @change="saveAutoPause" /> @@ -909,10 +909,13 @@ async function loadIdleTimeout() { async function saveIdleTimeout() { try { - await axios.post('/api/bot/settings', { - idleTimeoutMinutes: idleTimeout.value, - autoPauseOnEmpty: autoPauseOnEmpty.value, - }); + await axios.post('/api/bot/settings', { idleTimeoutMinutes: idleTimeout.value }); + } catch { /* ignore */ } +} + +async function saveAutoPause() { + try { + await axios.post('/api/bot/settings', { autoPauseOnEmpty: autoPauseOnEmpty.value }); } catch { /* ignore */ } }