From e36c3392d36e49ffec75b571554dc1e77e3d09f1 Mon Sep 17 00:00:00 2001 From: voidReq <100312344+voidReq@users.noreply.github.com> Date: Mon, 19 Oct 2026 19:50:31 -0400 Subject: [PATCH] Apply: a finished row's buttons disappear without switching tabs Co-Authored-By: Claude Sonnet 5.5 --- src/nuauto/gui.py | 7 ++++++- src/nuauto/gui_static/app.js | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nuauto/gui.py b/src/nuauto/gui.py index 34b6e03..3a72fca 100644 --- a/src/nuauto/gui.py +++ b/src/nuauto/gui.py @@ -246,7 +246,7 @@ def start(self, kind, label, cmd, browser=True, background=False, env=None, on_d f"pid {holder.get('pid')}). Try again when it is done.") scr = run_screen(kind) if watch and REMOTE and not config.DEMO else None task = Task(kind, label, cmd, browser, background, env, on_done=self._done(on_done), - on_row=None if background else self.refresh_soon, screen=scr) + on_row=None if background else self.refresh_after_row, screen=scr) if background: self.background = task else: @@ -282,6 +282,11 @@ def refresh_rows(self, force=False): if force or self.rows is None or now() - self.rows_at >= 60: self.run_group("sheet") + def refresh_after_row(self): + """A row just finished in a run: read the sheet again for sure (refresh_soon skips while another read is under + way, which would leave the finished row's buttons on the Apply screen until the next read).""" + threading.Thread(target=self.refresh_rows, kwargs={"force": True}, daemon=True).start() + def refresh_soon(self, max_age=0): """Read the sheet again in the background when the rows are older than max_age seconds, so the lists and counts follow changes made elsewhere (a row finished in a run, an assistant in a terminal, the sheet itself). A failed diff --git a/src/nuauto/gui_static/app.js b/src/nuauto/gui_static/app.js index 12e93b0..276072c 100644 --- a/src/nuauto/gui_static/app.js +++ b/src/nuauto/gui_static/app.js @@ -202,7 +202,9 @@ async function pollTask() { if (t) { S.taskLog.push(...t.log); S.taskAfter = t.log_total; + const doneBefore = S.task && S.task.id === t.id ? S.task.done_rows.length : 0; S.task = t; + if (t.done_rows.length > doneBefore) setTimeout(pollState, 1500); // a row finished: the lists read the sheet again now const was = S.lastTaskState[t.id]; S.lastTaskState[t.id] = t.state; if (was === "running" && t.state !== "running") taskFinished(t);