@@ -113,6 +113,11 @@ export function shouldFilter<T extends SharedVNode>(
113
113
return true ;
114
114
}
115
115
116
+ // TODO: Add a virtual root node to be able to filter the actual
117
+ // ones. Currently we have a workaround on the extension side
118
+ // that filters it there, but we should really do it here to be
119
+ // consistent with all other filters.
120
+
116
121
if ( vnode . type === config . Fragment && filters . type . has ( "fragment" ) ) {
117
122
const parent = bindings . getVNodeParent ( vnode ) ;
118
123
// Only filter non-root nodes
@@ -121,6 +126,12 @@ export function shouldFilter<T extends SharedVNode>(
121
126
return false ;
122
127
} else if ( bindings . isElement ( vnode ) && filters . type . has ( "dom" ) ) {
123
128
return true ;
129
+ } else if ( filters . type . has ( "hoc" ) ) {
130
+ const name = bindings . getDisplayName ( vnode , config ) ;
131
+
132
+ if ( name . indexOf ( "(" ) > - 1 && ! name . startsWith ( "ForwardRef" ) ) {
133
+ return true ;
134
+ }
124
135
}
125
136
126
137
if ( filters . regex . length > 0 ) {
@@ -169,75 +180,62 @@ function mount<T extends SharedVNode>(
169
180
const root = bindings . isRoot ( vnode , config ) ;
170
181
171
182
const skip = shouldFilter ( vnode , filters , config , bindings ) ;
172
-
173
- if ( root || ! skip ) {
174
- record: {
175
- let name = bindings . getDisplayName ( vnode , config ) ;
176
-
177
- if ( filters . type . has ( "hoc" ) ) {
178
- const hocName = getHocName ( name ) ;
179
-
180
- // Filter out HOC-Components
181
- if ( hocName ) {
182
- if ( name . startsWith ( "ForwardRef" ) ) {
183
- hocs = [ ...hocs , hocName ] ;
184
- const idx = name . indexOf ( "(" ) ;
185
- name = name . slice ( idx + 1 , - 1 ) || "Anonymous" ;
186
- } else {
187
- hocs = [ ...hocs , hocName ] ;
188
- break record;
189
- }
190
- }
183
+ let name = bindings . getDisplayName ( vnode , config ) ;
184
+
185
+ if ( filters . type . has ( "hoc" ) ) {
186
+ const hocName = getHocName ( name ) ;
187
+ if ( hocName ) {
188
+ hocs = [ ...hocs , hocName ] ;
189
+ if ( name . startsWith ( "ForwardRef" ) ) {
190
+ const idx = name . indexOf ( "(" ) ;
191
+ name = name . slice ( idx + 1 , - 1 ) || "Anonymous" ;
191
192
}
193
+ }
194
+ }
192
195
193
- const id = getOrCreateVNodeId ( ids , vnode ) ;
194
- if ( bindings . isRoot ( vnode , config ) ) {
195
- commit . operations . push ( MsgTypes . ADD_ROOT , id ) ;
196
- }
196
+ if ( root || ! skip ) {
197
+ const id = getOrCreateVNodeId ( ids , vnode ) ;
198
+ if ( bindings . isRoot ( vnode , config ) ) {
199
+ commit . operations . push ( MsgTypes . ADD_ROOT , id ) ;
200
+ }
197
201
198
- if ( ! timings . start . has ( id ) ) {
199
- timings . start . set ( id , timingsByVNode . start . get ( vnode ) || 0 ) ;
200
- }
201
- if ( ! timings . end . has ( id ) ) {
202
- timings . end . set ( id , timingsByVNode . end . get ( vnode ) || 0 ) ;
203
- }
202
+ if ( ! timings . start . has ( id ) ) {
203
+ timings . start . set ( id , timingsByVNode . start . get ( vnode ) || 0 ) ;
204
+ }
205
+ if ( ! timings . end . has ( id ) ) {
206
+ timings . end . set ( id , timingsByVNode . end . get ( vnode ) || 0 ) ;
207
+ }
204
208
205
- commit . operations . push (
206
- MsgTypes . ADD_VNODE ,
207
- id ,
208
- getDevtoolsType ( vnode , bindings ) , // Type
209
- ancestorId ,
210
- 9999 , // owner
211
- getStringId ( commit . strings , name ) ,
212
- vnode . key ? getStringId ( commit . strings , vnode . key ) : 0 ,
213
- // Multiply, because operations array only supports integers
214
- // and would otherwise cut off floats
215
- ( timings . start . get ( id ) || 0 ) * 1000 ,
216
- ( timings . end . get ( id ) || 0 ) * 1000 ,
217
- ) ;
209
+ commit . operations . push (
210
+ MsgTypes . ADD_VNODE ,
211
+ id ,
212
+ getDevtoolsType ( vnode , bindings ) , // Type
213
+ ancestorId ,
214
+ 9999 , // owner
215
+ getStringId ( commit . strings , name ) ,
216
+ vnode . key ? getStringId ( commit . strings , vnode . key ) : 0 ,
217
+ // Multiply, because operations array only supports integers
218
+ // and would otherwise cut off floats
219
+ ( timings . start . get ( id ) || 0 ) * 1000 ,
220
+ ( timings . end . get ( id ) || 0 ) * 1000 ,
221
+ ) ;
218
222
219
- if ( hocs . length > 0 ) {
220
- addHocs ( commit , id , hocs ) ;
221
- hocs = [ ] ;
222
- }
223
+ if ( hocs . length > 0 ) {
224
+ addHocs ( commit , id , hocs ) ;
225
+ hocs = [ ] ;
226
+ }
223
227
224
- // Capture render reason (mount here)
225
- if ( profiler . isProfiling && profiler . captureRenderReasons ) {
226
- commit . operations . push (
227
- MsgTypes . RENDER_REASON ,
228
- id ,
229
- RenderReason . MOUNT ,
230
- 0 ,
231
- ) ;
232
- }
228
+ // Capture render reason (mount here)
229
+ if ( profiler . isProfiling && profiler . captureRenderReasons ) {
230
+ commit . operations . push ( MsgTypes . RENDER_REASON , id , RenderReason . MOUNT , 0 ) ;
231
+ }
233
232
234
- updateHighlight ( profiler , vnode , bindings ) ;
233
+ updateHighlight ( profiler , vnode , bindings ) ;
235
234
236
- ancestorId = id ;
237
- }
235
+ ancestorId = id ;
238
236
}
239
237
240
- if ( skip && typeof vnode . type !== "function" ) {
238
+ if ( skip && ! bindings . isComponent ( vnode ) ) {
241
239
const dom = bindings . getDom ( vnode ) ;
242
240
if ( dom ) domCache . set ( dom , vnode ) ;
243
241
}
0 commit comments