@@ -467,7 +467,7 @@ function queueSetupTasks(newQueueLength: number) {
467467function flushSetup ( ) {
468468 let component ;
469469 while ( ( component = setupTasks . shift ( ) ) ) {
470- if ( ! component . __persistentState ) continue ;
470+ if ( ! component . __persistentState || ! component . _parentDom ) continue ;
471471 try {
472472 component . __persistentState . _pendingSetup . forEach ( invokeCleanup ) ;
473473 component . __persistentState . _pendingSetup . forEach ( invokeEffect ) ;
@@ -527,11 +527,11 @@ function getState(index: number): HookState {
527527
528528export function useStoreValueOnce < T > ( factory : ( ) => T ) : T {
529529 const state = getState ( currentHookIndex ++ ) ;
530- if ( ! state . _stored ) {
530+ if ( ! state . _stored || ( options as any ) . _skipEffects ) {
531531 state . _stored = true ;
532- state . _value = factory ( ) ;
532+ state . _stateValue = factory ( ) ;
533533 }
534- return state . _value ;
534+ return state . _stateValue ;
535535}
536536
537537export function useRef < T > ( initialValue : T ) : { current : T } {
@@ -542,14 +542,14 @@ function useOnce(callback: () => void | (() => void)): void {
542542 const state = getState ( currentHookIndex ++ ) ;
543543 if ( ! state . _executed ) {
544544 state . _executed = true ;
545- state . _value = callback ;
545+ state . _stateValue = callback ;
546546 currentComponent ! . __persistentState . _pendingSetup . push ( state ) ;
547547 }
548548}
549549
550550function invokeEffect ( hook : HookState ) : void {
551- if ( hook . _value ) {
552- hook . _cleanup = hook . _value ( ) || undefined ;
551+ if ( hook . _stateValue ) {
552+ hook . _cleanup = hook . _stateValue ( ) || undefined ;
553553 }
554554}
555555
0 commit comments