Skip to content

perf: improve file selection in table view#2940

Merged
JammingBen merged 3 commits into
mainfrom
perf/table-view-selection
Jul 24, 2026
Merged

perf: improve file selection in table view#2940
JammingBen merged 3 commits into
mainfrom
perf/table-view-selection

Conversation

@JammingBen

@JammingBen JammingBen commented Jul 22, 2026

Copy link
Copy Markdown
Member

Basically the same as #2939 but for the table view. Unfortunately, the setup is a bit more complicated here because we have ResourceTable > OcTable (design-system) > Tr (design-system).

Selecting/deselecting resources in the table view re-rendered the whole list, replaying all per-row helpers (getResourceLink, isVisible) once per row. This gets quite expensive with >100 files.

  • Extract OcTableRow so each row computes its own memoized highlight/disabled state. This ensures that a change of this state only re-renders the affected rows instead of the entire table.
  • Read the selection from the store in useResourceViewHelpers instead of a selectedIds prop; drop the prop from ResourceTable/ResourceTiles and the :selected-ids input from the views. Keeping this input and changing it also causes a re-render of the entire component.
  • Extract ResourceTableSelectAll leaf, use Set-based O(1) lookups for highlight- and disabled-checks (when still using the highlighted prop) and remove the dead rowMounted emit and checkbox outline handling.

closes #2937

Use Set-based O(1) lookups for highlight- and disabled-checks for
better performance.
Selecting/deselecting resources in the table view re-rendered the whole
list, replaying per-row helpers (getResourceLink, isVisible) once per row.

- Extract OcTableRow so each row computes its own memoized highlight/disabled
  state. This ensures that a change of this state only re-renders the affected
  rows instead of the entire table.
- Read the selection from the store in useResourceViewHelpers instead of a
  selectedIds prop; drop the prop from ResourceTable/ResourceTiles and the
  :selected-ids input from the views. Keeping this input and changing it
  also causes a re-render of the entire component.
- Extract ResourceTableSelectAll leaf, dedupe cell helpers into helpers/table.ts,
  and remove the dead rowMounted emit and checkbox outline handling.
Having the thumbnail interpolated in the list item key of each table row
causes the component to render twice: 1. initially and 2. later after the
thumbnail has been loaded.
@JammingBen
JammingBen force-pushed the perf/table-view-selection branch from 6407616 to f5e3458 Compare July 23, 2026 07:22
Base automatically changed from perf/tiles-view-selection to main July 23, 2026 07:41
@JammingBen
JammingBen marked this pull request as ready for review July 23, 2026 07:42
@JammingBen
JammingBen requested a review from AlexAndBear July 23, 2026 07:42

@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.

🥇

@JammingBen
JammingBen merged commit 9e709ba into main Jul 24, 2026
30 checks passed
@JammingBen
JammingBen deleted the perf/table-view-selection branch July 24, 2026 04:23
openclouders pushed a commit that referenced this pull request Jul 24, 2026
perf: improve file selection in table view
@openclouders openclouders mentioned this pull request Jul 24, 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.

File selection is slow with many files

2 participants