react icon indicating copy to clipboard operation
react copied to clipboard

Fix slots infinite rendering when no `context` prop is provided

Open iansan5653 opened this issue 3 years ago • 4 comments

First, updated the slots tests to that the context prop is not always defined. This caused the tests to fail due to infinite rendering, as expected from #2187.

Then, fixed the bug by defaulting context to a statically referenced frozen object instead of a new object on every render. This fixes #2187 and makes the tests pass ✅.

Merge checklist

  • [x] Added/updated tests
  • ~~[ ] Added/updated documentation~~
  • [ ] Tested in Chrome
  • [ ] Tested in Firefox
  • [ ] Tested in Safari
  • [ ] Tested in Edge

iansan5653 avatar Aug 05 '22 17:08 iansan5653

🦋 Changeset detected

Latest commit: 99149327b92042d57bb4a24a63de9e30ea50f3cd

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 Aug 05 '22 17:08 changeset-bot[bot]

size-limit report 📦

Path Size
dist/browser.esm.js 72.96 KB (+0.03% 🔺)
dist/browser.umd.js 73.33 KB (+0.02% 🔺)

github-actions[bot] avatar Aug 05 '22 17:08 github-actions[bot]

Just realized I totally missed the existing slots test file. Going to put this back in draft for now until I fix that 😅

iansan5653 avatar Aug 05 '22 19:08 iansan5653

Fixed - deleted my new test and updated the existing ones to not always define the context object.

iansan5653 avatar Aug 05 '22 19:08 iansan5653