Skip to content

Commit 9fce7f8

Browse files
committed
Avoid unnecessary table rerenders
This patch prevents certain actions from causing all table rows to rerender, if the actions did not actually effect the table rows. It does this by refactoring the table component so that redux state updates only trigger rerenders in the components that actually use the update data. Actions include: - Selecting a single row. - Opening the page size dropdown. - Displaying a tooltip by hovering over a hoverable table element.
1 parent 4ebc58b commit 9fce7f8

7 files changed

Lines changed: 461 additions & 309 deletions

File tree

src/components/events/Events.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const Events = () => {
5555
const editMetadataEventsModalRef = useRef<ModalHandle>(null);
5656

5757
const user = useAppSelector(state => getUserInformation(state));
58-
const showActions = useAppSelector(state => isShowActions(state));
5958
const events = useAppSelector(state => getTotalEvents(state));
6059
const isFetchingAssetUploadOptions = useAppSelector(state => getIsFetchingAssetUploadOptions(state));
6160

@@ -214,7 +213,7 @@ const Events = () => {
214213
text: "BULK_ACTIONS.EDIT_EVENTS_METADATA.CAPTION",
215214
}
216215
]}
217-
disabled={!showActions}
216+
isShowActions={isShowActions}
218217
/>
219218
{/* Include filters component*/}
220219
<TableFilters

src/components/events/Series.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const Series = () => {
4444
let location = useLocation();
4545

4646
const series = useAppSelector(state => getTotalSeries(state));
47-
const showActions = useAppSelector(state => isShowActions(state));
4847

4948
useEffect(() => {
5049
// State variable for interrupting the load function
@@ -139,7 +138,7 @@ const Series = () => {
139138
text: "BULK_ACTIONS.DELETE.SERIES.CAPTION",
140139
},
141140
]}
142-
disabled={!showActions}
141+
isShowActions={isShowActions}
143142
/>
144143
{/* Include filters component */}
145144
<TableFilters

0 commit comments

Comments
 (0)