Skip to content

Perf/gallery selection - #38

Merged
anderstorstensson merged 4 commits into
mainfrom
perf/gallery-selection
Aug 27, 2026
Merged

Perf/gallery selection#38
anderstorstensson merged 4 commits into
mainfrom
perf/gallery-selection

Conversation

@anderstorstensson

Copy link
Copy Markdown
Member

No description provided.

anderstorstensson and others added 4 commits August 26, 2026 21:22
Selecting images (click, drag-select, or the Select Page/All and
Deselect All buttons) re-rendered the entire page of image cards on the
server for every selection change, greying out the gallery while Shiny
recomputed the HTML and the browser rebuilt the DOM - purely to apply a
border color the client-side JS had already drawn.

- gallery renderUI now isolates rv$selected_images; click/drag styling
  is handled client-side as before, so selection changes no longer
  invalidate the render
- Select Page / Select All / Deselect All sync card styling via a new
  setSelectedCards custom message instead of a full re-render
- relabeling and all sample/mode switches also reassign
  rv$classifications in the same observer, so those re-renders pick up
  the cleared selection with no extra sync
- remaining renders are faster: per-card which() scan over
  original_classifications replaced with a named-vector lookup built
  once per render, and per-card selection membership vectorized
The selected (3px blue) and relabeled (3px yellow) borders made cards
4px wider/taller than the default 1px border, so selecting an image
could push the last card of a flex row onto the next line, shifting
image positions mid-selection.

Move all card visual state from inline styles (server render +
updateCardStyle JS) into .image-card CSS rules where border + padding
always sum to 8px, so state toggles change color only, never geometry.
This also lets the JS drop updateCardStyle and the data-relabeled
attribute entirely: deselecting simply reveals the class-based yellow
border again.
@anderstorstensson
anderstorstensson merged commit 8c02d91 into main Aug 27, 2026
7 checks passed
@anderstorstensson
anderstorstensson deleted the perf/gallery-selection branch August 27, 2026 06:06
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