Perf/gallery selection - #38
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.