@@ -467,7 +467,7 @@ function queueSetupTasks(newQueueLength: number) {
467
467
function flushSetup ( ) {
468
468
let component ;
469
469
while ( ( component = setupTasks . shift ( ) ) ) {
470
- if ( ! component . __persistentState ) continue ;
470
+ if ( ! component . __persistentState || ! component . _parentDom ) continue ;
471
471
try {
472
472
component . __persistentState . _pendingSetup . forEach ( invokeCleanup ) ;
473
473
component . __persistentState . _pendingSetup . forEach ( invokeEffect ) ;
@@ -527,11 +527,11 @@ function getState(index: number): HookState {
527
527
528
528
export function useStoreValueOnce < T > ( factory : ( ) => T ) : T {
529
529
const state = getState ( currentHookIndex ++ ) ;
530
- if ( ! state . _stored ) {
530
+ if ( ! state . _stored || ( options as any ) . _skipEffects ) {
531
531
state . _stored = true ;
532
- state . _value = factory ( ) ;
532
+ state . _stateValue = factory ( ) ;
533
533
}
534
- return state . _value ;
534
+ return state . _stateValue ;
535
535
}
536
536
537
537
export function useRef < T > ( initialValue : T ) : { current : T } {
@@ -542,14 +542,14 @@ function useOnce(callback: () => void | (() => void)): void {
542
542
const state = getState ( currentHookIndex ++ ) ;
543
543
if ( ! state . _executed ) {
544
544
state . _executed = true ;
545
- state . _value = callback ;
545
+ state . _stateValue = callback ;
546
546
currentComponent ! . __persistentState . _pendingSetup . push ( state ) ;
547
547
}
548
548
}
549
549
550
550
function invokeEffect ( hook : HookState ) : void {
551
- if ( hook . _value ) {
552
- hook . _cleanup = hook . _value ( ) || undefined ;
551
+ if ( hook . _stateValue ) {
552
+ hook . _cleanup = hook . _stateValue ( ) || undefined ;
553
553
}
554
554
}
555
555
0 commit comments