react icon indicating copy to clipboard operation
react copied to clipboard

fix(ButtonBase): memoize sx prop

Open joshblack opened this issue 3 years ago • 2 comments

Closes 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 avatar Sep 12 '22 15:09 joshblack

🦋 Changeset detected

Latest commit: fa5a770d9ea7562fb631394b9f8ddab8d014947b

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

changeset-bot[bot] avatar Sep 12 '22 15:09 changeset-bot[bot]

size-limit report 📦

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

github-actions[bot] avatar Sep 12 '22 16:09 github-actions[bot]