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 slots infinite rendering when no context prop is provided #2219

Merged
merged 5 commits into from
Aug 11, 2022

Conversation

iansan5653
Copy link
Contributor

@iansan5653 iansan5653 commented Aug 5, 2022

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

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

@iansan5653 iansan5653 requested a review from a team August 5, 2022 17:45
@iansan5653 iansan5653 self-assigned this Aug 5, 2022
@changeset-bot
Copy link

changeset-bot bot commented Aug 5, 2022

🦋 Changeset detected

Latest commit: 9914932

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 Aug 5, 2022

size-limit report 📦

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

@iansan5653 iansan5653 temporarily deployed to github-pages August 5, 2022 17:51 Inactive
@iansan5653 iansan5653 temporarily deployed to github-pages August 5, 2022 17:51 Inactive
@iansan5653
Copy link
Contributor Author

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

@iansan5653 iansan5653 marked this pull request as draft August 5, 2022 19:06
@iansan5653 iansan5653 marked this pull request as ready for review August 5, 2022 19:09
@iansan5653
Copy link
Contributor Author

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

@iansan5653 iansan5653 temporarily deployed to github-pages August 5, 2022 19:15 Inactive
@iansan5653 iansan5653 temporarily deployed to github-pages August 5, 2022 19:15 Inactive
Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

LGTM!

@iansan5653 iansan5653 enabled auto-merge (squash) August 11, 2022 16:16
@iansan5653 iansan5653 temporarily deployed to github-pages August 11, 2022 16:22 Inactive
@iansan5653 iansan5653 merged commit af534f1 into main Aug 11, 2022
@iansan5653 iansan5653 deleted the fix-slots-infinite-render branch August 11, 2022 16:24
@iansan5653 iansan5653 temporarily deployed to github-pages August 11, 2022 16:24 Inactive
@primer-css primer-css mentioned this pull request Aug 11, 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.

Using Slots without a context prop results an infinite render loop
2 participants