@@ -6,7 +6,10 @@ import {
6
6
HTML_LOWER_CASE ,
7
7
HTML_ENUMERATED ,
8
8
SVG_CAMEL_CASE ,
9
- createComponent
9
+ createComponent ,
10
+ setDirty ,
11
+ unsetDirty ,
12
+ isDirty
10
13
} from './lib/util.js' ;
11
14
import { options , h , Fragment } from 'preact' ;
12
15
import {
@@ -15,7 +18,6 @@ import {
15
18
COMPONENT ,
16
19
DIFF ,
17
20
DIFFED ,
18
- DIRTY ,
19
21
NEXT_STATE ,
20
22
PARENT ,
21
23
RENDER ,
@@ -174,8 +176,9 @@ function renderClassComponent(vnode, context) {
174
176
175
177
c . props = vnode . props ;
176
178
c . context = context ;
177
- // turn off stateful re-rendering:
178
- c [ DIRTY ] = true ;
179
+
180
+ // Turn off stateful rendering
181
+ setDirty ( c ) ;
179
182
180
183
if ( c . state == null ) c . state = EMPTY_OBJ ;
181
184
@@ -370,8 +373,8 @@ function _renderToString(
370
373
// This will need to be updated for Preact 11 to use internal.flags rather than component._dirty:
371
374
// https://github.com/preactjs/preact/blob/d4ca6fdb19bc715e49fd144e69f7296b2f4daa40/src/diff/component.js#L35-L44
372
375
let count = 0 ;
373
- while ( component [ DIRTY ] && count ++ < 25 ) {
374
- component [ DIRTY ] = false ;
376
+ while ( isDirty ( component ) && count ++ < 25 ) {
377
+ unsetDirty ( component ) ;
375
378
376
379
if ( renderHook ) renderHook ( vnode ) ;
377
380
@@ -384,7 +387,8 @@ function _renderToString(
384
387
throw e ;
385
388
}
386
389
}
387
- component [ DIRTY ] = true ;
390
+
391
+ setDirty ( component ) ;
388
392
}
389
393
390
394
if ( component . getChildContext != null ) {
@@ -425,7 +429,7 @@ function _renderToString(
425
429
component . componentDidCatch ( err , EMPTY_OBJ ) ;
426
430
}
427
431
428
- if ( component [ DIRTY ] ) {
432
+ if ( isDirty ( component ) ) {
429
433
rendered = renderClassComponent ( vnode , context ) ;
430
434
component = vnode [ COMPONENT ] ;
431
435
0 commit comments