Skip to content

Commit

Permalink
Add missing if statement in #waitForCondition (#2961)
Browse files Browse the repository at this point in the history
  • Loading branch information
camertron committed Jul 22, 2024
1 parent 0f1b9d8 commit b662625
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-apples-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/view-components': patch
---

Ensure condition is checked when mutations occur in SelectPanelElement.
6 changes: 4 additions & 2 deletions app/components/primer/alpha/select_panel_element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,10 @@ export class SelectPanelElement extends HTMLElement {
body()
} else {
const mutationObserver = new MutationObserver(() => {
body()
mutationObserver.disconnect()
if (condition()) {
body()
mutationObserver.disconnect()
}
})

mutationObserver.observe(this, {childList: true, subtree: true})
Expand Down

0 comments on commit b662625

Please sign in to comment.