@@ -28,19 +28,19 @@ export function injectNgtRef<TElement>(
2828) : NgtInjectedRef < TElement > {
2929 injector = assertInjector ( injectNgtRef , injector ) ;
3030 const ref = is . ref ( initial ) ? initial : new ElementRef ( initial as TElement ) ;
31- const signalRef = signal ( ref . nativeElement ) ;
32- const readonlySignal = signalRef . asReadonly ( ) ;
33- const cached = new Map ( ) ;
31+ const refSignal = signal ( ref . nativeElement ) ;
32+ const readonlyRef = refSignal . asReadonly ( ) ;
33+ const computedCached = new Map ( ) ;
3434
3535 return runInInjectionContext ( injector , ( ) => {
36- inject ( DestroyRef ) . onDestroy ( ( ) => void cached . clear ( ) ) ;
36+ inject ( DestroyRef ) . onDestroy ( ( ) => void computedCached . clear ( ) ) ;
3737
3838 const children = ( type : 'objects' | 'nonObjects' | 'both' = 'objects' ) => {
39- if ( ! cached . has ( type ) ) {
40- cached . set (
39+ if ( ! computedCached . has ( type ) ) {
40+ computedCached . set (
4141 type ,
4242 computed ( ( ) => {
43- const instance = readonlySignal ( ) ;
43+ const instance = readonlyRef ( ) ;
4444 if ( ! instance ) return [ ] ;
4545 const localState = getLocalState ( instance ) ;
4646 if ( ! localState . objects || ! localState . nonObjects ) return [ ] ;
@@ -50,21 +50,21 @@ export function injectNgtRef<TElement>(
5050 } ) ,
5151 ) ;
5252 }
53- return cached . get ( type ) ! ;
53+ return computedCached . get ( type ) ! ;
5454 } ;
5555
5656 Object . defineProperties ( ref , {
5757 nativeElement : {
5858 set : ( newElement ) => {
5959 untracked ( ( ) => {
60- if ( newElement !== signalRef ( ) ) {
61- signalRef . set ( newElement ) ;
60+ if ( newElement !== refSignal ( ) ) {
61+ refSignal . set ( newElement ) ;
6262 }
6363 } ) ;
6464 } ,
65- get : readonlySignal ,
65+ get : readonlyRef ,
6666 } ,
67- untracked : { get : ( ) => untracked ( readonlySignal ) } ,
67+ untracked : { get : ( ) => untracked ( readonlyRef ) } ,
6868 children : { get : ( ) => children } ,
6969 } ) ;
7070
0 commit comments