Skip to content

Commit

Permalink
fix: load popup styles asap
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmaddock committed Jul 7, 2020
1 parent 28aa1fe commit 38e31c5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/metastream-app/src/components/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,12 @@ export class PopupWindow extends Component<Props, State> {
mediaPopupReady: Boolean(PopupWindow.mediaWindowRef && !PopupWindow.mediaWindowRef.closed)
})

if (this.stylesheetObserver) {
this.stylesheetObserver.disconnect()
}

this.stylesheetObserver = new MutationObserver(this.onHeadMutation)
this.stylesheetObserver.observe(document.head, {
childList: true
})
this.stylesheetObserver.observe(document.head, { childList: true })

this.copyStyleSheets()
}
Expand Down Expand Up @@ -260,6 +262,7 @@ export class PopupWindow extends Component<Props, State> {
}

if (windowRef) {
windowRef.addEventListener('DOMContentLoaded', this.onWindowLoad)
windowRef.addEventListener('load', this.onWindowLoad)
PopupWindow.remoteWindowRef = windowRef
}
Expand Down

0 comments on commit 38e31c5

Please sign in to comment.