File tree Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Expand file tree Collapse file tree 3 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,13 @@ function updateHighlight<T extends SharedVNode>(
48
48
bindings : PreactBindings < T > ,
49
49
) {
50
50
if ( profiler . highlightUpdates && bindings . isComponent ( vnode ) ) {
51
- const stack : any [ ] = [ vnode ] ;
51
+ const stack : Array < T | null | undefined > = [ vnode ] ;
52
52
let item ;
53
53
let dom ;
54
54
while ( ( item = stack . shift ( ) ) !== undefined ) {
55
+ // Account for placholders/holes
56
+ if ( item === null ) continue ;
57
+
55
58
if ( ! bindings . isComponent ( item ) ) {
56
59
dom = bindings . getDom ( item ) ;
57
60
break ;
Original file line number Diff line number Diff line change
1
+ import { h , render } from "preact" ;
2
+ import { useState } from "preact/hooks" ;
3
+
4
+ function Foo ( props ) {
5
+ return props . children ;
6
+ }
7
+
8
+ function App ( ) {
9
+ const [ v , set ] = useState ( 0 ) ;
10
+
11
+ return (
12
+ < Foo >
13
+ { v % 2 === 0 && "Not a placeholder" }
14
+ < button onClick = { ( ) => set ( v + 1 ) } > Increment</ button >
15
+ </ Foo >
16
+ ) ;
17
+ }
18
+
19
+ render ( < App /> , document . getElementById ( "app" ) ) ;
Original file line number Diff line number Diff line change
1
+ import {
2
+ newTestPage ,
3
+ click ,
4
+ clickTab ,
5
+ waitForSelector ,
6
+ } from "../../test-utils" ;
7
+ import { expect } from "chai" ;
8
+ import { clickSelector } from "pentf/browser_utils" ;
9
+
10
+ export const description = "Check if highlight updates is rendered" ;
11
+
12
+ export async function run ( config : any ) {
13
+ const { page, devtools } = await newTestPage ( config , "holes" ) ;
14
+ await waitForSelector ( page , "button" ) ;
15
+
16
+ await clickTab ( devtools , "SETTINGS" ) ;
17
+ await click ( devtools , '[data-testId="toggle-highlight-updates"]' ) ;
18
+
19
+ const errors : string [ ] = [ ] ;
20
+ page . on ( "pageerror" , err => errors . push ( err . toString ( ) ) ) ;
21
+
22
+ await clickSelector ( page , "button" ) ;
23
+ await clickSelector ( page , "button" ) ;
24
+
25
+ expect ( errors ) . to . deep . equal ( [ ] ) ;
26
+ }
You can’t perform that action at this time.
0 commit comments