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 performance regression causing unnecessary redraws #6285

Merged
merged 5 commits into from
May 18, 2021

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented May 17, 2021

Problem

Our context hooks (e.g. useListContext) always return new items, even though nothing has changed.

The problem is that they use lodash/merge, which is recursive. When merging complex objects, the result is almost always a new object.

Solution

Use lodash/extend instead.
Use lodash/defaults instead (because extend considers undefined values as an override, see https://stackoverflow.com/a/33247597/1333479)

Before

image

After

image

@fzaninotto fzaninotto added the RFR Ready For Review label May 17, 2021
Copy link
Contributor

@djhi djhi left a comment

Choose a reason for hiding this comment

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

🔥

@djhi djhi added this to the 3.15.2 milestone May 18, 2021
@djhi djhi merged commit 5680479 into master May 18, 2021
@djhi djhi deleted the fix-context-identity-pref-regression branch May 18, 2021 06:17
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.

2 participants