1
- import { ChangeDetectorRef , inject , Injectable } from '@angular/core' ;
1
+ import { ChangeDetectorRef , Injectable } from '@angular/core' ;
2
2
import { RxState } from '@rx-angular/state' ;
3
3
import { combineLatest , MonoTypeOperatorFunction , Observable , startWith , tap } from 'rxjs' ;
4
4
import type { NgtAnyRecord } from '../types' ;
5
5
import { is } from '../utils/is' ;
6
- import { safeDetectChanges } from '../utils/safe-detect-changes' ;
7
6
8
7
export const startWithUndefined = < T > ( ) : MonoTypeOperatorFunction < T > => startWith < T > ( undefined ! as T ) ;
9
8
@@ -77,7 +76,6 @@ export class NgtRxStore<
77
76
> extends RxState < TRxState > {
78
77
constructor ( ) {
79
78
super ( ) ;
80
- const cdr = inject ( ChangeDetectorRef , { optional : true } ) ;
81
79
// set a dummy property so that initial this.get() won't return undefined
82
80
this . set ( { __ngt_dummy__ : '__ngt_dummy__' } as TRxState ) ;
83
81
// call initialize that might be setup by derived Stores
@@ -94,14 +92,10 @@ export class NgtRxStore<
94
92
modded [ key ] = value === undefined ? this . get ( key as keyof TRxState ) : value ;
95
93
return modded ;
96
94
} , { } as NgtAnyRecord ) ;
97
- const value = originalSet ( modArgs as Partial < TRxState > ) ;
98
- safeDetectChanges ( cdr ) ;
99
- return value ;
95
+ return originalSet ( modArgs as Partial < TRxState > ) ;
100
96
}
101
97
// @ts -expect-error not sure why ...args here doesn't pass tuple check
102
- const value = originalSet ( ...args ) ;
103
- safeDetectChanges ( cdr ) ;
104
- return value ;
98
+ return originalSet ( ...args ) ;
105
99
} ;
106
100
} ,
107
101
} ) ;
0 commit comments