Skip to content

Commit b662625

Browse files
authored
Add missing if statement in #waitForCondition (#2961)
1 parent 0f1b9d8 commit b662625

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/rotten-apples-greet.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/view-components': patch
3+
---
4+
5+
Ensure condition is checked when mutations occur in SelectPanelElement.

app/components/primer/alpha/select_panel_element.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ export class SelectPanelElement extends HTMLElement {
250250
body()
251251
} else {
252252
const mutationObserver = new MutationObserver(() => {
253-
body()
254-
mutationObserver.disconnect()
253+
if (condition()) {
254+
body()
255+
mutationObserver.disconnect()
256+
}
255257
})
256258

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

0 commit comments

Comments
 (0)