Skip to content

Refresh plots once when the Manage cells modal closes (#184) - #190

Merged
jepegit merged 4 commits into
mainfrom
cursor/184-defer-replot-cells-modal-713a
Oct 4, 2026
Merged

jepegit merged 4 commits into
mainfrom
cursor/184-defer-replot-cells-modal-713a

Conversation

@jepegit

@jepegit jepegit commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Closes #184

Stacked on #189 (base branch cursor/186-y-ranges-group-avg-spread-713a). Merge #189 first; GitHub retargets this PR to main when that branch is deleted. Only the #184 commit is new here.

Problem

Every edit in the Manage cells dialog fired a plot round-trip, and each response redrew the chart on arrival. After a burst of edits the figure kept re-rendering one intermediate state after another, long after the dialog was closed — while the modal was covering the chart in the first place.

Changes (front-end only)

  • Defer while the modal is open. updateCell / selectAll / selectGroup / removeCell now go through _replotAfterEdit(), which only flags a pending redraw while the modal is open. closeCellsManager() redraws the current tab once. Sidebar edits still redraw immediately.
  • Drop stale responses. Each chart (summary / cycles / cell, incl. compare) carries a request sequence number; _fetchFigure returns null for a response overtaken by a newer request, so it is never drawn. plotBusy is backed by an in-flight counter, so the spinner stays until the last request settles instead of vanishing when the first one comes back.
  • Modal footer hint: "Plots refresh when this dialog closes." → "Edits saved — the plots refresh when this dialog closes." once something changed.

Tests

  • New Playwright e2e test_cells_modal_defers_plot_refresh_until_close: label + group + none/all edits inside the modal issue 0 /api/plots/* requests, Close issues exactly 1, reopen/close without edits issues none. Fails on the previous JS, passes now. (Skips without Playwright, as the rest of the e2e module; CI runs -m essential.)
  • Full uv run pytest green.

Manual walkthrough (server mode, demo cells)

Group/label edits and none/all inside the modal → no redraw; Close → one redraw with the new grouping; rapid checkbox toggling in the sidebar ends in a consistent figure.

cells_modal_deferred_replot_184.mp4

Also

  • Design note in .issueflows/04-designs-and-guides/manage-cells-modal.md; .issueflows/ tracking files; graphify artifacts refreshed.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 3, 2026 22:12
The per-panel y-range lookup reads the summary column id out of each trace's
hovertemplate (variable=<id>). With Spread on, the app's hover rewrite from #40
had already replaced that id with the pretty axis title by the time the ranges
were applied, so none of them matched a facet axis and every panel stayed
autoscaled. figure_json now resolves the variable -> axis map straight after
collection.plot and passes it to _apply_y_ranges.

Adds regression tests for both-ends and one-sided ranges on the spread path.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Edits made inside the Manage cells dialog used to fire one plot round-trip
each, and every response redrew the chart on arrival, so after a burst of
edits the figure kept re-rendering long after the dialog had closed.

Edits now route through _replotAfterEdit(), which only flags a pending redraw
while the modal is open; closing it redraws the current tab once. Every plot
fetch also carries a per-chart sequence number, and a response overtaken by a
newer request is dropped rather than drawn, with the busy spinner held until
the last in-flight request settles. The modal footer says when the refresh
happens. Adds a Playwright e2e test counting /api/plots requests.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
cursoragent and others added 2 commits October 4, 2026 06:12
…ot-cells-modal-713a

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
@jepegit
jepegit merged commit bff7d6a into main Oct 4, 2026
2 checks passed
@jepegit
jepegit deleted the cursor/184-defer-replot-cells-modal-713a branch October 4, 2026 06:21
jepegit added a commit that referenced this pull request Oct 4, 2026
…s-713a

Keep the group-name additions after #189 and #190 squash-merged into main.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

update plots when cells modal closes

2 participants