Skip to content

Dock panels, and restore the viewer after a page reload - #23

Merged
jiajic merged 1 commit into
devfrom
feat/panel-docking
Nov 2, 2026
Merged

jiajic merged 1 commit into
devfrom
feat/panel-docking

Conversation

@jiajic

@jiajic jiajic commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

What changes

  • Docking. Chart panels dock beside the spatial view as tabs and splits, can be dragged, closed, and added back from a + menu in each tab bar. The spatial view is not a panel and stays where it is. Default: scatter above histogram (tabs when the dock is short).
  • Stable panel ids. Each panel's id names its dock slot, its selection source (scatter / scatter:<id>, panel:<id>) and its data file, so moving a panel changes nothing else.
  • R API. push_panel(spec, data, id = NULL, title = NULL, where = c("tab", "right", "below"), ref = NULL) returns the id; pushing to an existing id replaces that chart in place; works before a browser connects. pane = is dropped. New: remove_panel(id), panels(). describe() and state() list panels.
  • Restore on reload. zustand's persist middleware sends the config (layers, images, genes, colouring, annotations, tool settings, layout) to R on change, merged over 300 ms. R keeps it verbatim as JSON text and sends it back first when a page connects (restore), followed by metadata, rules and the pushed panels it holds. Protocol 2 → 3.
  • Brushes from rules. The histogram and pushed charts draw their brush from their own rule (a brush, R, or a reload), so a restored range can still be dragged. A pushed chart's ids rule keeps params.brush.
  • Background tabs skip selection updates and catch up when shown.

Choices

  • dockview-core 4.13.1, pinned (adr/0009). 8.8.3 bundles every feature module (368 KB / 88 KB gz JS) and its module build ships no stylesheet. golden-layout has had no release since Feb 2023. Bundle cost: main chunk 2,076 → 2,245 KB (+41 KB gz), plus a 37 KB stylesheet (4 KB gz).
  • R holds the saved config, not browser storage: R outlives the page, re-pushes the panels the layout names, and a save to file (Save the viewer state to a file and restore it in a later session #21) can start from its copy.

Not in this PR

Tests

  • vitest 52/52; tsc clean.
  • R suite passes, including new socket tests (config round trip, held panels, panel_closed) and e2e tests (placement, reload restoring layout, panels, settings, selection and draggable brushes).
  • The flaky "rules are visible" e2e test (failed 4–5 of 8 runs, on dev too) clicked a rule's × before the page had received the rule; it now waits. 8/8 runs pass.
  • R CMD check --no-tests: 0 errors, 0 warnings, 1 note (R6, grDevices and later listed in Imports but not imported).

🤖 Generated with Claude Code

Chart panels dock as tabs and splits (dockview-core 4) with stable ids;
push_panel() places them (id, where, ref), remove_panel() and panels()
are new. R keeps the page's config and re-sends it on reload (protocol 3).
Brushes are drawn from their rules, so restored ranges can be dragged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jiajic
jiajic merged commit 6e3f156 into dev Nov 2, 2026
2 of 3 checks passed
@jiajic
jiajic deleted the feat/panel-docking branch November 2, 2026 19:38
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.

1 participant