File tree Expand file tree Collapse file tree 1 file changed +13
-17
lines changed
packages/devtools-utils/src/angular Expand file tree Collapse file tree 1 file changed +13
-17
lines changed Original file line number Diff line number Diff line change 1- import { afterNextRender } from '@angular/core'
2-
31export type DevtoolsPanelProps = {
42 theme ?: 'dark' | 'light' | 'system'
53}
@@ -34,7 +32,7 @@ export function createAngularPanel<
3432 return [
3533 ( ) =>
3634 ( inputs : ( ) => TComponentProps , host : HTMLElement ) : ( ( ) => void ) => {
37- const panel = document . createElement ( 'div' )
35+ const panel = host . ownerDocument . createElement ( 'div' )
3836 panel . style . height = '100%'
3937 let unmount : null | ( ( ) => void ) = null
4038
@@ -43,22 +41,20 @@ export function createAngularPanel<
4341 unmount = ( ) => instance . unmount ( )
4442 }
4543
46- afterNextRender ( ( ) => {
47- host . appendChild ( panel )
44+ host . appendChild ( panel )
4845
49- const isConstructor = isPanelClassConstructor <
50- TComponentProps ,
51- TCoreDevtoolsClass
52- > ( CoreClass )
46+ const isConstructor = isPanelClassConstructor <
47+ TComponentProps ,
48+ TCoreDevtoolsClass
49+ > ( CoreClass )
5350
54- if ( isConstructor ) {
55- mount ( new CoreClass ( inputs ( ) ) )
56- } else {
57- CoreClass ( )
58- . then ( ( ResolvedCoreClass ) => new ResolvedCoreClass ( inputs ( ) ) )
59- . then ( mount )
60- }
61- } )
51+ if ( isConstructor ) {
52+ mount ( new CoreClass ( inputs ( ) ) )
53+ } else {
54+ CoreClass ( )
55+ . then ( ( ResolvedCoreClass ) => new ResolvedCoreClass ( inputs ( ) ) )
56+ . then ( mount )
57+ }
6258
6359 return ( ) => {
6460 unmount ?.( )
You can’t perform that action at this time.
0 commit comments