-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this commit, we reduce the usage of RxJS utilities as they may be redundant. For example, we replace the replay subject with a behavior subject and remove some unnecessary operators.
- Loading branch information
Showing
5 changed files
with
42 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 10 additions & 5 deletions
15
packages/store/internals/src/ngxs-app-bootstrapped-state.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { ReplaySubject } from 'rxjs'; | ||
import { DestroyRef, inject, Injectable } from '@angular/core'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class ɵNgxsAppBootstrappedState extends ReplaySubject<boolean> { | ||
export class ɵNgxsAppBootstrappedState extends BehaviorSubject<boolean> { | ||
constructor() { | ||
super(1); | ||
super(false); | ||
|
||
const destroyRef = inject(DestroyRef); | ||
// Complete the subject once the root injector is destroyed to ensure | ||
// there are no active subscribers that would receive events or perform | ||
// any actions after the application is destroyed. | ||
destroyRef.onDestroy(() => this.complete()); | ||
} | ||
|
||
bootstrap(): void { | ||
this.next(true); | ||
this.complete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters