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

Improved performance for lists in layered components #1221

Merged
merged 3 commits into from
May 12, 2021

Conversation

dgreif
Copy link
Member

@dgreif dgreif commented May 12, 2021

Pulling in some performance tweaks that I found useful when working on SelectPanel

  • Map items to new ItemProps objects, rather than overwriting renderItem. This creates less functions, and prevents new DOM elements from being created if the list is re-rendered while open
  • useMemo for the item conversion, which prevents the conversioning happening before the menu opens and after it opens. Now it just converts items once.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot
Copy link

changeset-bot bot commented May 12, 2021

🦋 Changeset detected

Latest commit: ab3849f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented May 12, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/DPJBAuvKpqyGbwSwEnWR15UP4eiH
✅ Preview: https://primer-components-git-layered-components-perf-primer.vercel.app

@vercel vercel bot temporarily deployed to Preview May 12, 2021 16:22 Inactive
src/ActionMenu.tsx Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview May 12, 2021 20:01 Inactive
@vercel vercel bot temporarily deployed to Preview May 12, 2021 20:05 Inactive
@vercel vercel bot temporarily deployed to Preview May 12, 2021 20:22 Inactive
@dgreif dgreif enabled auto-merge (squash) May 12, 2021 20:30
Copy link
Contributor

@VanAnderson VanAnderson left a comment

Choose a reason for hiding this comment

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

👍

@dgreif dgreif merged commit a926081 into main May 12, 2021
@dgreif dgreif deleted the layered-components-perf branch May 12, 2021 20:40
@github-actions github-actions bot mentioned this pull request May 12, 2021
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.

None yet

3 participants