Skip to content

perf: improve file selection in tiles view#2939

Merged
JammingBen merged 2 commits into
mainfrom
perf/tiles-view-selection
Jul 23, 2026
Merged

perf: improve file selection in tiles view#2939
JammingBen merged 2 commits into
mainfrom
perf/tiles-view-selection

Conversation

@JammingBen

Copy link
Copy Markdown
Member

ResourceTile now derives its own selected state from the resources store instead of receiving it as a prop and exposes it to the selection slot as a scoped prop. This removes all selectedIds reads from ResourceTiles' render, so a selection toggle no longer re-renders the whole list.

Further improves selection performance by using a Set-based O(1) membership checks instead of Array.includes/indexOf in useResourceViewHelpers (isResourceSelected) and the resources store.

refs #2937

- Use Set-based O(1) membership checks instead of Array.includes/indexOf in
  useResourceViewHelpers (isResourceSelected) and the resources store
- Drop the now-unused selectedResources computed from useResourceViewHelpers
  by deriving the drag selection from resources + selectedIds in useResourceViewDrag
ResourceTile now derives its own selected state from the resources store
(via a shared selectedIdsSet getter) instead of receiving it as a prop and
exposes it to the selection slot as a scoped prop.

This removes the last selectedIds reads from ResourceTiles' render, so a
selection toggle no longer re-renders the whole list. Only the tiles whose
selected boolean actually flips re-render (Vue's computed change detection),
instead of replaying every tile's slot code and per-item helpers.
:drag-drop="dragDrop"
:hover="hover"
:item-dom-selector="resourceDomSelector"
:selection="selectedResources"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This prop doesn't exist on OcTable.

@JammingBen
JammingBen requested a review from AlexAndBear July 22, 2026 11:54

@AlexAndBear AlexAndBear left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't measure the improvement but altogether this makes totally sense 👍

@JammingBen
JammingBen merged commit 6212da4 into main Jul 23, 2026
31 checks passed
@JammingBen
JammingBen deleted the perf/tiles-view-selection branch July 23, 2026 07:41
@openclouders openclouders mentioned this pull request Jul 23, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants