Skip to content

Commit ea51ae4

Browse files
authored
Merge pull request #2310 from ngxs/refactor/pull-less-rxjs_2
refactor(store): pull less RxJS symbols
2 parents 86e5d99 + 36ea83f commit ea51ae4

File tree

6 files changed

+19
-11
lines changed

6 files changed

+19
-11
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $ npm install @ngxs/store@dev
88

99
- Refactor: Replace `ngOnDestroy` with `DestroyRef` [#2289](https://github.com/ngxs/store/pull/2289)
1010
- Refactor: Reduce RxJS dependency [#2292](https://github.com/ngxs/store/pull/2292)
11-
- Refactor: Pull less RxJS symbols [#2309](https://github.com/ngxs/store/pull/2309)
11+
- Refactor: Pull less RxJS symbols [#2309](https://github.com/ngxs/store/pull/2309) [#2310](https://github.com/ngxs/store/pull/2310)
1212
- Fix(store): Add root store initializer guard [#2278](https://github.com/ngxs/store/pull/2278)
1313
- Fix(store): Reduce change detection cycles with pending tasks [#2280](https://github.com/ngxs/store/pull/2280)
1414
- Fix(store): Complete action results on destroy [#2282](https://github.com/ngxs/store/pull/2282)

packages/devtools-plugin/src/devtools.plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
NgxsNextPluginFn,
77
NgxsPlugin
88
} from '@ngxs/store/plugins';
9-
import { tap, catchError } from 'rxjs/operators';
9+
import { tap, catchError } from 'rxjs';
1010

1111
import { NGXS_DEVTOOLS_OPTIONS, NgxsDevtoolsAction, NgxsDevtoolsExtension } from './symbols';
1212

packages/storage-plugin/src/storage.plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
ɵALL_STATES_PERSISTED,
1515
ɵNGXS_STORAGE_PLUGIN_OPTIONS
1616
} from '@ngxs/storage-plugin/internals';
17-
import { tap } from 'rxjs/operators';
17+
import { tap } from 'rxjs';
1818

1919
import { getStorageKey } from './internals';
2020
import { ɵNgxsStoragePluginKeysManager } from './keys-manager';

packages/store/src/internal/dispatcher.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { inject, Injectable, Injector, NgZone, runInInjectionContext } from '@angular/core';
2-
import { EMPTY, forkJoin, Observable, throwError } from 'rxjs';
3-
import { filter, map, mergeMap, shareReplay, take } from 'rxjs/operators';
2+
import {
3+
EMPTY,
4+
forkJoin,
5+
Observable,
6+
throwError,
7+
filter,
8+
map,
9+
mergeMap,
10+
shareReplay,
11+
take
12+
} from 'rxjs';
413

514
import { getActionTypeFromInstance } from '@ngxs/store/plugins';
615
import { ɵPlainObject, ɵStateStream, ɵof } from '@ngxs/store/internals';
@@ -97,7 +106,7 @@ export class InternalDispatcher {
97106
// state, as its result is used by plugins.
98107
return ɵof(this._stateStream.getValue());
99108
case ActionStatus.Errored:
100-
return throwError(() => ctx.error);
109+
throw ctx.error;
101110
default:
102111
// Once dispatched or canceled, we complete it immediately because
103112
// `dispatch()` should emit (or error, or complete) as soon as it succeeds or fails.

packages/store/src/operators/of-action.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getActionTypeFromInstance } from '@ngxs/store/plugins';
2-
import { OperatorFunction, Observable } from 'rxjs';
3-
import { map, filter } from 'rxjs/operators';
2+
import { type OperatorFunction, type Observable, map, filter } from 'rxjs';
43

54
import { ActionType } from '../actions/symbols';
65
import { ActionContext, ActionStatus } from '../actions-stream';

packages/store/src/store.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { computed, inject, Injectable, Signal } from '@angular/core';
22
import {
3-
Observable,
4-
Subscription,
3+
type Observable,
4+
type Subscription,
55
throwError,
66
catchError,
77
distinctUntilChanged,
@@ -80,7 +80,7 @@ export class Store {
8080
}
8181

8282
// rethrow other errors
83-
return throwError(error);
83+
throw error;
8484
}),
8585
distinctUntilChanged(),
8686
leaveNgxs(this._internalExecutionStrategy)

0 commit comments

Comments
 (0)