Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ReferenceManyField renders too often #5612

Merged
merged 1 commit into from Dec 2, 2020
Merged

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Dec 2, 2020

Problem

ReferenceManyField rerenders whenever something in the resource changes. even unrelated changes like selected ids. This wastes CPU time and slows down List page interactions (a bit).

Solution

Fix the data selector in useGetMany, which uses reselect to memoize the result... But has a too broad dependency array.

Before

Check the Tags column: all rows rerender when only one row is selected

getmany_not_optimized

After

Now only the selected row rerenders

getmany_optimized

@fzaninotto fzaninotto added the RFR Ready For Review label Dec 2, 2020
@djhi djhi added this to the 3.10.4 milestone Dec 2, 2020
@djhi djhi merged commit 3fed1f9 into master Dec 2, 2020
@djhi djhi deleted the ReferenceManyField-rerender branch December 2, 2020 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants