This repository was archived by the owner on May 25, 2021. It is now read-only.
Commit 198c699 Steven Kampen
authored
File tree 3 files changed +18
-8
lines changed
frontend/components/injector-tree
3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -68,12 +68,16 @@ const messageBuffer = new MessageQueue<Message<any>>();
68
68
/// NOTE(cbond): We collect roots from all applications (mulit-app support)
69
69
let previousTree : MutableTree ,
70
70
previousCount : number ,
71
+ initialModules : { [ key : string ] : any } ,
71
72
onMouseOver ,
72
73
onMouseDown ;
73
74
74
- const parseInitialModules = ( roots : Array < any > ) => {
75
- if ( roots . length ) {
76
- messageBuffer . enqueue ( MessageFactory . ngModules ( parseModules ( roots [ 0 ] ) ) ) ;
75
+ const parseInitialModules = ( ) => {
76
+ const roots = getAllAngularRootElements ( ) . map ( r => ng . probe ( r ) ) ;
77
+ if ( ! initialModules && roots . length ) {
78
+ initialModules = parseModules ( roots [ 0 ] ) ;
79
+ messageBuffer . enqueue ( MessageFactory . ngModules ( initialModules ) ) ;
80
+ send ( MessageFactory . push ( ) ) ;
77
81
}
78
82
} ;
79
83
@@ -132,7 +136,6 @@ const bind = (root) => {
132
136
133
137
// initial load
134
138
subject . next ( void 0 ) ;
135
- parseInitialModules ( getAllAngularRootElements ( ) . map ( r => ng . probe ( r ) ) ) ;
136
139
} ;
137
140
138
141
const checkDebug = ( fn : ( ) => void ) => {
@@ -159,6 +162,8 @@ const resubscribe = () => {
159
162
subscriptions . splice ( 0 , subscriptions . length ) ;
160
163
161
164
getAllAngularRootElements ( ) . forEach ( root => bind ( ng . probe ( root ) ) ) ;
165
+
166
+ setTimeout ( parseInitialModules ) ;
162
167
} ) ;
163
168
} ;
164
169
Original file line number Diff line number Diff line change @@ -40,18 +40,19 @@ const randomId = () => {
40
40
} ;
41
41
42
42
const resolveTokenIdMetaData = ( token , tokenIdMap : { [ key : string ] : any } ) => {
43
- let tokenId = '' ;
43
+ let tokenId = null ;
44
44
if ( typeof token === 'string' ) {
45
45
tokenId = token ;
46
46
} else {
47
47
if ( ! Reflect . getMetadata ( AUGURY_TOKEN_ID_METADATA_KEY , token ) ) {
48
+ tokenId = randomId ( ) ;
48
49
while ( tokenIdMap [ tokenId ] ) {
49
50
tokenId = randomId ( ) ;
50
51
}
51
52
Reflect . defineMetadata ( AUGURY_TOKEN_ID_METADATA_KEY , tokenId , token ) ;
52
53
}
53
54
}
54
- return { token : token , augury_token_id : tokenId } ;
55
+ return { token : token , augury_token_id : tokenId || Reflect . getMetadata ( AUGURY_TOKEN_ID_METADATA_KEY , token ) } ;
55
56
} ;
56
57
57
58
const parseProviderName = p =>
Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ <h3 class="monospace primary-color">
44
44
< ul class ="list-reset m0 ">
45
45
< li >
46
46
< span class ="info-key "> NgModule:</ span >
47
- < span class ="info-value "> {{ngModules.tokenIdMap[parentHierarchy[focusedComponent].augury_token_id].module}}</ span >
47
+ < span class ="info-value " *ngIf ="ngModules && ngModules.tokenIdMap[parentHierarchy[focusedComponent].augury_token_id] ">
48
+ {{ngModules.tokenIdMap[parentHierarchy[focusedComponent].augury_token_id].module}}
49
+ </ span >
48
50
</ li >
49
51
</ ul >
50
52
</ div >
@@ -62,7 +64,9 @@ <h3 class="monospace primary-color">
62
64
</ li >
63
65
< li >
64
66
< span class ="info-key "> NgModule:</ span >
65
- < span class ="info-value "> {{ngModules.tokenIdMap[parentHierarchy[focusedComponent].dependencies[focusedDependency].id].module}}</ span >
67
+ < span *ngIf ="ngModules && ngModules.tokenIdMap[parentHierarchy[focusedComponent].dependencies[focusedDependency].id] " class ="info-value ">
68
+ {{ngModules.tokenIdMap[parentHierarchy[focusedComponent].dependencies[focusedDependency].id].module}}
69
+ </ span >
66
70
</ li >
67
71
</ ul >
68
72
</ div >
You can’t perform that action at this time.
0 commit comments