Skip to content

Conversation

@SimonHeybrock
Copy link
Member

@SimonHeybrock SimonHeybrock commented Dec 8, 2025

Summary

  • Add dynamic=True to PlotGridTabs, so Panel only renders the visible tab instead of all tabs simultaneously. This was the primary cause of 3-5 second lag when changing grid settings. It is likely also responsible for avoiding total freezes, but we will not to monitor this more in the future.
  • Defer on_first_data callback using pn.state.execute() to break synchronous callback chains that blocked the UI during plot creation.
  • Optimize PlotGrid cell updates by modifying button properties in-place instead of deleting and recreating widgets on each click.
  • Add pn.io.hold() batching to PlotConfigModal wizard initialization, cascade handlers, and ConfigurationWidget to reduce render cycles.

Closes #575

🤖 Generated with Claude Code

SimonHeybrock and others added 3 commits December 8, 2025 12:39
Address performance issues where the dashboard UI partially freezes and
only unfreezes when switching desktops. The root causes were unbatched
widget updates and rendering all tabs simultaneously.

Key fix:
- Add dynamic=True to PlotGridTabs, so Panel only renders the visible tab
  instead of all tabs simultaneously. This was the primary cause of 3-5
  second lag when changing grid settings.

Additional fixes:
- Add pn.io.hold() to PlotConfigModal wizard initialization and cascade
  handlers (_initialize_selections, _on_namespace_change, _on_workflow_change)
- Prevent redundant _update_preview() calls in PlotGridManager by adding
  a suppression flag during batch operations
- Replace 1ms periodic callback hack with pn.state.execute() for deferred
  plot insertion
- Add pn.io.hold() to ConfigurationWidget._on_aux_source_changed()

See docs/developer/plans/dashboard-ui-freezing-investigation.md for
detailed analysis of the issue.

Prompt: I need your help investigating some serious performance issues I see
when running the dashboard when I have multiple tabs with plot grids. The UI
often partially freezes, not reacting to clicks or changes - but then switching
to a different desktop and back again suddenly unfreezes.
When subscribing to a workflow that already has data, the callback chain
previously ran synchronously: subscribe_to_workflow() → on_job_available()
→ setup_data_pipeline() → register_subscriber() → trigger() → on_first_data()
→ create_plot(), all blocking the UI until complete.

Now on_first_data is deferred using pn.state.execute(), allowing the
subscription to return immediately and plot creation to happen on the
next event loop iteration.
Instead of deleting and recreating all cell widgets on each click,
update existing button properties in-place. This avoids the overhead
of Panel widget creation (event binding, DOM manipulation, etc.).

Changes:
- Add CellAppearance dataclass to hold computed styling properties
- Add _compute_cell_appearance() to extract styling computation
- Store button references in _cell_buttons dict for fast updates
- Add _update_cell_in_place() to modify button properties directly
- Simplify _refresh_all_cells() to use in-place updates

Prompt: The mechanism in PlotGrid that updates cells after clicking
is very slow - sometimes takes a couple of seconds. Any ideas of
how to make it better?

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-project-automation github-project-automation bot moved this to In progress in Development Board Dec 8, 2025
@SimonHeybrock SimonHeybrock moved this from In progress to Selected in Development Board Dec 8, 2025
@nvaytet nvaytet self-assigned this Dec 8, 2025
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct that apart from adding with pn.io.hold(), only indentation has changed in this file?

@SimonHeybrock SimonHeybrock merged commit 9ba29e5 into main Dec 8, 2025
4 checks passed
@SimonHeybrock SimonHeybrock deleted the fix-dashboard-ui-freezing branch December 8, 2025 13:54
@github-project-automation github-project-automation bot moved this from Selected to Done in Development Board Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

UI freezes temporarily

3 participants