@@ -28,19 +28,19 @@ export function injectNgtRef<TElement>(
28
28
) : NgtInjectedRef < TElement > {
29
29
injector = assertInjector ( injectNgtRef , injector ) ;
30
30
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 ( ) ;
34
34
35
35
return runInInjectionContext ( injector , ( ) => {
36
- inject ( DestroyRef ) . onDestroy ( ( ) => void cached . clear ( ) ) ;
36
+ inject ( DestroyRef ) . onDestroy ( ( ) => void computedCached . clear ( ) ) ;
37
37
38
38
const children = ( type : 'objects' | 'nonObjects' | 'both' = 'objects' ) => {
39
- if ( ! cached . has ( type ) ) {
40
- cached . set (
39
+ if ( ! computedCached . has ( type ) ) {
40
+ computedCached . set (
41
41
type ,
42
42
computed ( ( ) => {
43
- const instance = readonlySignal ( ) ;
43
+ const instance = readonlyRef ( ) ;
44
44
if ( ! instance ) return [ ] ;
45
45
const localState = getLocalState ( instance ) ;
46
46
if ( ! localState . objects || ! localState . nonObjects ) return [ ] ;
@@ -50,21 +50,21 @@ export function injectNgtRef<TElement>(
50
50
} ) ,
51
51
) ;
52
52
}
53
- return cached . get ( type ) ! ;
53
+ return computedCached . get ( type ) ! ;
54
54
} ;
55
55
56
56
Object . defineProperties ( ref , {
57
57
nativeElement : {
58
58
set : ( newElement ) => {
59
59
untracked ( ( ) => {
60
- if ( newElement !== signalRef ( ) ) {
61
- signalRef . set ( newElement ) ;
60
+ if ( newElement !== refSignal ( ) ) {
61
+ refSignal . set ( newElement ) ;
62
62
}
63
63
} ) ;
64
64
} ,
65
- get : readonlySignal ,
65
+ get : readonlyRef ,
66
66
} ,
67
- untracked : { get : ( ) => untracked ( readonlySignal ) } ,
67
+ untracked : { get : ( ) => untracked ( readonlyRef ) } ,
68
68
children : { get : ( ) => children } ,
69
69
} ) ;
70
70
0 commit comments