Skip to content

don't recreate hostElements each time #4033

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

Merged
merged 2 commits into from
Dec 8, 2023

Conversation

keithamus
Copy link
Contributor

@keithamus keithamus commented Dec 8, 2023

Closes #4032

Changelog

New

Changed

Fixed confirm() leaving <div>s in the DOM.

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@keithamus keithamus requested review from a team and pksjce December 8, 2023 16:12
Copy link

changeset-bot bot commented Dec 8, 2023

🦋 Changeset detected

Latest commit: a7900b6

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

Copy link
Contributor

github-actions bot commented Dec 8, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 105.15 KB (+0.01% 🔺)
dist/browser.umd.js 105.68 KB (+0.01% 🔺)

Copy link
Contributor

@mperrotti mperrotti left a comment

Choose a reason for hiding this comment

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

🙌

@@ -150,7 +150,7 @@ export type ConfirmOptions = Omit<ConfirmationDialogProps, 'onClose'> & {content
async function confirm(themeProps: ThemeProviderProps, options: ConfirmOptions): Promise<boolean> {
const {content, ...confirmationDialogProps} = options
return new Promise(resolve => {
hostElement = document.createElement('div')
hostElement ||= document.createElement('div')
Copy link
Contributor

Choose a reason for hiding this comment

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

I've never used this operator. I love it!

@keithamus keithamus added this pull request to the merge queue Dec 8, 2023
Merged via the queue into main with commit bca709d Dec 8, 2023
@keithamus keithamus deleted the don-t-recreate-hostelements-each-time branch December 8, 2023 19:13
@primer primer bot mentioned this pull request Dec 8, 2023
TylerJDev pushed a commit that referenced this pull request Dec 11, 2023
* don't recreate hostElements each time

* changeset
@primer primer bot mentioned this pull request Dec 19, 2023
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.

hostElement is added to DOM on each ConfirmationDialog
2 participants