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(ButtonBase): memoize sx prop #2323

Merged
merged 9 commits into from
Oct 10, 2022
Merged

fix(ButtonBase): memoize sx prop #2323

merged 9 commits into from
Oct 10, 2022

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Sep 12, 2022

Part of https://github.com/github/primer/issues/1191

This PR tackles some of the small wins identified by @mattcosta7 over in https://github.com/github/primer/issues/1191

Specifically, it focuses on providing stable identity for StyledButton and the two underlying Box components in ButtonBase by:

  • Pull out iconWrapStyles as a constant
  • Pull out trailingIconStyles as a constant
  • Create a default value for the sx prop, this allows it to be passed into sxStyles without triggering a new object each render

@joshblack joshblack requested review from a team and mperrotti September 12, 2022 15:57
@changeset-bot
Copy link

changeset-bot bot commented Sep 12, 2022

🦋 Changeset detected

Latest commit: fa5a770

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

This PR includes changesets to release 1 package
Name Type
@primer/react 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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2022

size-limit report 📦

Path Size
dist/browser.esm.js 77.21 KB (+0.03% 🔺)
dist/browser.umd.js 77.85 KB (+0.05% 🔺)

@joshblack joshblack temporarily deployed to github-pages September 12, 2022 16:06 Inactive
@joshblack joshblack temporarily deployed to github-pages September 13, 2022 15:24 Inactive
@joshblack joshblack temporarily deployed to github-pages September 27, 2022 21:57 Inactive
@joshblack joshblack temporarily deployed to github-pages September 30, 2022 15:28 Inactive
@joshblack joshblack requested review from siddharthkp and removed request for mperrotti and colebemis October 5, 2022 19:35
@joshblack joshblack temporarily deployed to github-pages October 5, 2022 19:42 Inactive
@joshblack joshblack requested review from colebemis and removed request for colebemis October 7, 2022 18:35
@joshblack joshblack temporarily deployed to github-pages October 10, 2022 16:11 Inactive
@joshblack joshblack merged commit 9c0c107 into main Oct 10, 2022
@joshblack joshblack deleted the 1191-update-button-perf-2 branch October 10, 2022 16:45
@primer-css primer-css mentioned this pull request Oct 10, 2022
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.

3 participants