@@ -92,7 +92,7 @@ function SignalValue(this: AugmentedComponent, { data }: { data: Signal }) {
92
92
const currentSignal = useSignal ( data ) ;
93
93
currentSignal . value = data ;
94
94
95
- const [ isText , s ] = useStoreOnce ( ( ) => {
95
+ const [ isText , s ] = useStoreValueOnce ( ( ) => {
96
96
let self = this ;
97
97
// mark the parent component as having computeds so it gets optimized
98
98
let v = this . __v ;
@@ -404,7 +404,7 @@ Component.prototype.shouldComponentUpdate = function (
404
404
export function useSignal < T > ( value : T , options ?: SignalOptions < T > ) : Signal < T > ;
405
405
export function useSignal < T = undefined > ( ) : Signal < T | undefined > ;
406
406
export function useSignal < T > ( value ?: T , options ?: SignalOptions < T > ) {
407
- return useStoreOnce ( ( ) =>
407
+ return useStoreValueOnce ( ( ) =>
408
408
signal < T | undefined > ( value , options as SignalOptions )
409
409
) ;
410
410
}
@@ -413,7 +413,9 @@ export function useComputed<T>(compute: () => T, options?: SignalOptions<T>) {
413
413
const $compute = useRef ( compute ) ;
414
414
$compute . current = compute ;
415
415
( currentComponent as AugmentedComponent ) . _updateFlags |= HAS_COMPUTEDS ;
416
- return useStoreOnce ( ( ) => computed < T > ( ( ) => $compute . current ( ) , options ) ) ;
416
+ return useStoreValueOnce ( ( ) =>
417
+ computed < T > ( ( ) => $compute . current ( ) , options )
418
+ ) ;
417
419
}
418
420
419
421
function safeRaf ( callback : ( ) => void ) {
@@ -523,7 +525,7 @@ function getState(index: number): HookState {
523
525
return hooks . _list [ index ] ;
524
526
}
525
527
526
- function useStoreOnce < T > ( factory : ( ) => T ) : T {
528
+ export function useStoreValueOnce < T > ( factory : ( ) => T ) : T {
527
529
const state = getState ( currentHookIndex ++ ) ;
528
530
if ( ! state . _stored ) {
529
531
state . _stored = true ;
@@ -532,8 +534,8 @@ function useStoreOnce<T>(factory: () => T): T {
532
534
return state . _value ;
533
535
}
534
536
535
- function useRef < T > ( initialValue : T ) : { current : T } {
536
- return useStoreOnce ( ( ) => ( { current : initialValue } ) ) ;
537
+ export function useRef < T > ( initialValue : T ) : { current : T } {
538
+ return useStoreValueOnce ( ( ) => ( { current : initialValue } ) ) ;
537
539
}
538
540
539
541
function useOnce ( callback : ( ) => void | ( ( ) => void ) ) : void {
0 commit comments