Fix slots infinite rendering when no `context` prop is provided
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
🦋 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
size-limit report 📦
| Path | Size |
|---|---|
| dist/browser.esm.js | 72.96 KB (+0.03% 🔺) |
| dist/browser.umd.js | 73.33 KB (+0.02% 🔺) |
Just realized I totally missed the existing slots test file. Going to put this back in draft for now until I fix that 😅
Fixed - deleted my new test and updated the existing ones to not always define the context object.