Skip to content

Memoize input and meta#640

Open
asazernik wants to merge 2 commits intofinal-form:mainfrom
asazernik:memoize-input-and-meta
Open

Memoize input and meta#640
asazernik wants to merge 2 commits intofinal-form:mainfrom
asazernik:memoize-input-and-meta

Conversation

@asazernik
Copy link
Copy Markdown
Contributor

Preventing unnecessary re-renders is the name of the game. Users will only see gains if they pass in a pure/memoized component, but if they do it's a big difference.

The rule against nesting of hook calls requires us to change the
structure of this code somewhat.
If the child components of <Field> check for reference equality of their
props to decide to re-render, the old code was causing excessive
re-renders by changing the identity of input and meta props.
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 1, 2019

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (692f1d1) to head (40060ae).
⚠️ Report is 163 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #640   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          251       257    +6     
  Branches        58        57    -1     
=========================================
+ Hits           251       257    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@asazernik
Copy link
Copy Markdown
Contributor Author

asazernik commented Oct 21, 2019

Note on second glance - because of extensive whitespace changes, the diffs are best viewed with --color-words --ignore-space-change

@erikras
Copy link
Copy Markdown
Member

erikras commented Oct 28, 2019

Can you show me a render counting test that passes if meta and input are memoized but fails if they are not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants