Fix page reset on save: disable reload, handle orphaned timers

- Set reload=False to prevent watchfiles from triggering full page
  reloads when JSON/DB files are written during save
- Timeline graph poll timer (200ms) now deactivates itself when its
  parent slot is deleted during UI refresh
- Comfy monitor poll timer catches RuntimeError from deleted parent
  slots instead of crashing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 22:50:11 +01:00
parent efd0a31426
commit f3ad3e01bc
3 changed files with 19 additions and 11 deletions
+6 -1
View File
@@ -437,6 +437,8 @@ def render_timeline_tab(state: AppState):
render_timeline()
# --- Poll for graph node clicks (JS → Python bridge) ---
graph_timer = None
async def _poll_graph_click():
if view_mode.value == 'Linear Log':
return
@@ -446,6 +448,9 @@ def render_timeline_tab(state: AppState):
'window.graphSelectedNode = null; v;'
)
except Exception:
# Deactivate timer if parent slot was deleted
if graph_timer is not None:
graph_timer.active = False
return
if not result:
return
@@ -458,7 +463,7 @@ def render_timeline_tab(state: AppState):
selected['node_id'] = node_id
render_timeline.refresh()
ui.timer(0.2, _poll_graph_click)
graph_timer = ui.timer(0.2, _poll_graph_click)
def _render_graphviz(dot_source: str, selected_node_id: str | None = None):