Skip to content

Commit

Permalink
fix: correct parent in touchbar group and popover
Browse files Browse the repository at this point in the history
  • Loading branch information
erickzhao committed Feb 24, 2021
1 parent 257cca0 commit 86a37f7
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/browser/api/touch-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class TouchBarGroup extends TouchBarItem<Electron.TouchBarGroupConstructorOption
}
}
for (const item of newChild.orderedItems) {
item._addParent(item);
item._addParent(self);
}
})
child!: TouchBar;
Expand Down Expand Up @@ -173,14 +173,16 @@ class TouchBarPopover extends TouchBarItem<Electron.TouchBarPopoverConstructorOp
showCloseButton!: boolean;

@LiveProperty<TouchBarPopover>(config => config.items instanceof TouchBar ? config.items : new TouchBar(config.items), (self, newChild: TouchBar) => {
if (self.child) {
for (const item of self.child.orderedItems) {
item._removeParent(self);
setTimeout(() => {
if (self.child) {
for (const item of self.child.orderedItems) {
item._removeParent(self);
}
}
}
for (const item of newChild.orderedItems) {
item._addParent(item);
}
for (const item of newChild.orderedItems) {
item._addParent(self);
}
}, 2000);
})
child!: TouchBar;

Expand Down

0 comments on commit 86a37f7

Please sign in to comment.