Skip to content

Fix slots infinite rendering when no context prop is provided - #2219

Merged
iansan5653 merged 5 commits into
mainfrom
fix-slots-infinite-render
Aug 11, 2022
Merged

Fix slots infinite rendering when no context prop is provided#2219
iansan5653 merged 5 commits into
mainfrom
fix-slots-infinite-render

Conversation

@iansan5653

@iansan5653iansan5653 commented Aug 5, 2022

Copy link
Copy Markdown
Contributor

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 teamAugust 5, 2022 17:45
@iansan5653iansan5653 self-assigned this Aug 5, 2022
@changeset-bot

changeset-botBot commented Aug 5, 2022

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactPatch

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

github-actionsBot commented Aug 5, 2022

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js72.96 KB (+0.03% 🔺)
dist/browser.umd.js73.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
Copy Markdown
ContributorAuthor

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
Copy Markdown
ContributorAuthor

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

@siddharthkpsiddharthkp left a comment

Copy link
Copy Markdown
Member

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 mainAug 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-cssprimer-css mentioned this pull request Aug 11, 2022
Sign up for freeto 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

@iansan5653@siddharthkp