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

Use good keys when rendering arrays of components #675

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

julienw
Copy link
Contributor

@julienw julienw commented Jun 12, 2024

In this PR I make sure that all rows and group of rows have unique keys that don't change. Previously we were using the index. This should make React's reconciliation algorithm faster when doing operations such as filtering. See https://legacy.reactjs.org/docs/reconciliation.html for more information about this algorithm.

I profiled locally when filtering out and in a platform, and this seems a bit faster than previously.

I'm requesting review from Beatrice because she should know whether my assumptions are correct.

Copy link

netlify bot commented Jun 12, 2024

Deploy Preview for mozilla-perfcompare ready!

Name Link
🔨 Latest commit 20295f2
🔍 Latest deploy log https://app.netlify.com/sites/mozilla-perfcompare/deploys/666aec29afe28b000808df69
😎 Deploy Preview https://deploy-preview-675--mozilla-perfcompare.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Jun 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.41%. Comparing base (e3f14f5) to head (c23b07e).
Report is 1 commits behind head on beta.

Additional details and impacted files
@@           Coverage Diff           @@
##             beta     #675   +/-   ##
=======================================
  Coverage   91.41%   91.41%           
=======================================
  Files          69       69           
  Lines        1620     1620           
  Branches      291      291           
=======================================
  Hits         1481     1481           
  Misses        111      111           
  Partials       28       28           

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

julienw added a commit to julienw/perfcompare that referenced this pull request Jun 13, 2024
…ad of the index so that React's reconciliation algorithm works better
julienw added a commit to julienw/perfcompare that referenced this pull request Jun 13, 2024
@julienw julienw merged commit f7be860 into mozilla:beta Jun 13, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants