1- import { ChangeDetectorRef , inject , Injectable } from '@angular/core' ;
1+ import { ChangeDetectorRef , Injectable } from '@angular/core' ;
22import { RxState } from '@rx-angular/state' ;
33import { combineLatest , MonoTypeOperatorFunction , Observable , startWith , tap } from 'rxjs' ;
44import type { NgtAnyRecord } from '../types' ;
55import { is } from '../utils/is' ;
6- import { safeDetectChanges } from '../utils/safe-detect-changes' ;
76
87export const startWithUndefined = < T > ( ) : MonoTypeOperatorFunction < T > => startWith < T > ( undefined ! as T ) ;
98
@@ -77,7 +76,6 @@ export class NgtRxStore<
7776> extends RxState < TRxState > {
7877 constructor ( ) {
7978 super ( ) ;
80- const cdr = inject ( ChangeDetectorRef , { optional : true } ) ;
8179 // set a dummy property so that initial this.get() won't return undefined
8280 this . set ( { __ngt_dummy__ : '__ngt_dummy__' } as TRxState ) ;
8381 // call initialize that might be setup by derived Stores
@@ -94,14 +92,10 @@ export class NgtRxStore<
9492 modded [ key ] = value === undefined ? this . get ( key as keyof TRxState ) : value ;
9593 return modded ;
9694 } , { } as NgtAnyRecord ) ;
97- const value = originalSet ( modArgs as Partial < TRxState > ) ;
98- safeDetectChanges ( cdr ) ;
99- return value ;
95+ return originalSet ( modArgs as Partial < TRxState > ) ;
10096 }
10197 // @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 ) ;
10599 } ;
106100 } ,
107101 } ) ;
0 commit comments