@@ -154,7 +154,7 @@ export interface Chore<T extends ChoreType = ChoreType> {
154
154
$target$ : ChoreTarget | null ;
155
155
$payload$ : unknown ;
156
156
$state$ : ChoreState ;
157
- $blockedChores$ : Chore [ ] | null ;
157
+ $blockedChores$ : ChoreArray | null ;
158
158
$startTime$ : number | undefined ;
159
159
$endTime$ : number | undefined ;
160
160
@@ -361,10 +361,7 @@ This is often caused by modifying a signal in an already rendered component duri
361
361
return chore ;
362
362
}
363
363
if ( ! isRunningChore ( chore ) ) {
364
- const idx = choreQueue . add ( chore ) ;
365
- if ( idx < 0 && vnode_isVNode ( chore . $host$ ) ) {
366
- ( chore . $host$ . chores ||= new ChoreArray ( ) ) . add ( chore ) ;
367
- }
364
+ addChore ( chore , choreQueue ) ;
368
365
}
369
366
DEBUG && debugTrace ( 'schedule' , chore , choreQueue , blockedChores ) ;
370
367
@@ -460,7 +457,8 @@ This is often caused by modifying a signal in an already rendered component duri
460
457
if ( vnode_isVNode ( blockedChore . $host$ ) ) {
461
458
blockedChore . $host$ . blockedChores ?. delete ( blockedChore ) ;
462
459
}
463
- choreQueue . add ( blockedChore ) ;
460
+ addChore ( blockedChore , choreQueue ) ;
461
+ DEBUG && debugTrace ( 'schedule.UNBLOCKED' , blockedChore , choreQueue , blockedChores ) ;
464
462
blockedChoresScheduled = true ;
465
463
}
466
464
}
@@ -784,14 +782,21 @@ export function addBlockedChore(
784
782
undefined ,
785
783
blockedChores
786
784
) ;
787
- blockingChore . $blockedChores$ ||= [ ] ;
788
- blockingChore . $blockedChores$ . push ( blockedChore ) ;
785
+ blockingChore . $blockedChores$ ||= new ChoreArray ( ) ;
786
+ blockingChore . $blockedChores$ . add ( blockedChore ) ;
789
787
blockedChores . add ( blockedChore ) ;
790
788
if ( vnode_isVNode ( blockedChore . $host$ ) ) {
791
789
( blockedChore . $host$ . blockedChores ||= new ChoreArray ( ) ) . add ( blockedChore ) ;
792
790
}
793
791
}
794
792
793
+ export function addChore ( chore : Chore , choreArray : ChoreArray ) {
794
+ const idx = choreArray . add ( chore ) ;
795
+ if ( idx < 0 && vnode_isVNode ( chore . $host$ ) ) {
796
+ ( chore . $host$ . chores ||= new ChoreArray ( ) ) . add ( chore ) ;
797
+ }
798
+ }
799
+
795
800
function choreTypeToName ( type : ChoreType ) : string {
796
801
return (
797
802
(
0 commit comments