@@ -270,6 +270,7 @@ hook(OptionsTypes.DIFFED, (old, vnode) => {
270270 component . __persistentState &&
271271 component . __persistentState . _pendingSetup . length
272272 ) {
273+ console . log ( "f" , component . __persistentState . _pendingSetup ) ;
273274 queueSetupTasks ( setupTasks . push ( component ) ) ;
274275 }
275276 }
@@ -467,7 +468,8 @@ function queueSetupTasks(newQueueLength: number) {
467468function flushSetup ( ) {
468469 let component ;
469470 while ( ( component = setupTasks . shift ( ) ) ) {
470- if ( ! component . __persistentState ) continue ;
471+ console . log ( "flushSetup" , component . __P , component . __persistentState ) ;
472+ if ( ! component . __persistentState || ! component . __P ) continue ;
471473 try {
472474 component . __persistentState . _pendingSetup . forEach ( invokeCleanup ) ;
473475 component . __persistentState . _pendingSetup . forEach ( invokeEffect ) ;
@@ -527,11 +529,11 @@ function getState(index: number): HookState {
527529
528530export function useStoreValueOnce < T > ( factory : ( ) => T ) : T {
529531 const state = getState ( currentHookIndex ++ ) ;
530- if ( ! state . _stored ) {
532+ if ( ! state . _stored || ( options as any ) . _skipEffects ) {
531533 state . _stored = true ;
532- state . _value = factory ( ) ;
534+ state . _stateValue = factory ( ) ;
533535 }
534- return state . _value ;
536+ return state . _stateValue ;
535537}
536538
537539export function useRef < T > ( initialValue : T ) : { current : T } {
@@ -542,14 +544,15 @@ function useOnce(callback: () => void | (() => void)): void {
542544 const state = getState ( currentHookIndex ++ ) ;
543545 if ( ! state . _executed ) {
544546 state . _executed = true ;
545- state . _value = callback ;
547+ state . _stateValue = callback ;
546548 currentComponent ! . __persistentState . _pendingSetup . push ( state ) ;
547549 }
548550}
549551
550552function invokeEffect ( hook : HookState ) : void {
551- if ( hook . _value ) {
552- hook . _cleanup = hook . _value ( ) || undefined ;
553+ console . log ( "invokeEffect" , hook ) ;
554+ if ( hook . _stateValue ) {
555+ hook . _cleanup = hook . _stateValue ( ) || undefined ;
553556 }
554557}
555558
0 commit comments