@ngxs/store 3.7.3-dev.master-5abb12a → 3.7.3-dev.master-6ba2ac1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ngxs-store.umd.js +18 -2
- package/bundles/ngxs-store.umd.js.map +1 -1
- package/bundles/ngxs-store.umd.min.js +1 -1
- package/bundles/ngxs-store.umd.min.js.map +1 -1
- package/esm2015/src/store.js +20 -4
- package/esm5/src/store.js +20 -4
- package/fesm2015/ngxs-store.js +19 -3
- package/fesm2015/ngxs-store.js.map +1 -1
- package/fesm5/ngxs-store.js +19 -3
- package/fesm5/ngxs-store.js.map +1 -1
- package/ngxs-store.metadata.json +1 -1
- package/package.json +1 -1
- package/src/store.d.ts +6 -0
package/fesm5/ngxs-store.js
CHANGED
|
@@ -3,7 +3,7 @@ import { NgZone, Injectable, Inject, PLATFORM_ID, defineInjectable, inject, Inje
|
|
|
3
3
|
import { isAngularInTestMode, memoize, INITIAL_STATE_TOKEN, NgxsBootstrapper, NGXS_STATE_CONTEXT_FACTORY, NGXS_STATE_FACTORY, InitialState, ensureInjectorNotifierIsCaptured, localInject, ensureLocalInjectorCaptured } from '@ngxs/store/internals';
|
|
4
4
|
import { isPlatformServer } from '@angular/common';
|
|
5
5
|
import { Observable, Subject, BehaviorSubject, of, forkJoin, throwError, EMPTY, from } from 'rxjs';
|
|
6
|
-
import { filter, map, shareReplay, take, exhaustMap, mergeMap, defaultIfEmpty, catchError, takeUntil, tap, distinctUntilChanged } from 'rxjs/operators';
|
|
6
|
+
import { filter, map, shareReplay, take, exhaustMap, mergeMap, defaultIfEmpty, catchError, takeUntil, tap, publishReplay, refCount, distinctUntilChanged } from 'rxjs/operators';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview added by tsickle
|
|
@@ -3426,6 +3426,12 @@ var Store = /** @class */ (function () {
|
|
|
3426
3426
|
this._config = _config;
|
|
3427
3427
|
this._internalExecutionStrategy = _internalExecutionStrategy;
|
|
3428
3428
|
this._stateFactory = _stateFactory;
|
|
3429
|
+
/**
|
|
3430
|
+
* This is a derived state stream that leaves NGXS execution strategy to emit state changes within the Angular zone,
|
|
3431
|
+
* because state is being changed actually within the `<root>` zone, see `InternalDispatcher#dispatchSingle`.
|
|
3432
|
+
* All selects would use this stream, and it would call leave only once for any state change across all active selectors.
|
|
3433
|
+
*/
|
|
3434
|
+
this._selectableStateStream = this._stateStream.pipe(leaveNgxs(this._internalExecutionStrategy), publishReplay(1), refCount());
|
|
3429
3435
|
this.initStateStream(initialStateValue);
|
|
3430
3436
|
}
|
|
3431
3437
|
/**
|
|
@@ -3456,7 +3462,7 @@ var Store = /** @class */ (function () {
|
|
|
3456
3462
|
var _this = this;
|
|
3457
3463
|
/** @type {?} */
|
|
3458
3464
|
var selectorFn = this.getStoreBoundSelectorFn(selector);
|
|
3459
|
-
return this.
|
|
3465
|
+
return this._selectableStateStream.pipe(map(selectorFn), catchError((/**
|
|
3460
3466
|
* @param {?} err
|
|
3461
3467
|
* @return {?}
|
|
3462
3468
|
*/
|
|
@@ -3508,7 +3514,9 @@ var Store = /** @class */ (function () {
|
|
|
3508
3514
|
* @return {?}
|
|
3509
3515
|
*/
|
|
3510
3516
|
function (fn) {
|
|
3511
|
-
return this.
|
|
3517
|
+
return this._selectableStateStream
|
|
3518
|
+
.pipe(leaveNgxs(this._internalExecutionStrategy))
|
|
3519
|
+
.subscribe(fn);
|
|
3512
3520
|
};
|
|
3513
3521
|
/**
|
|
3514
3522
|
* Return the raw value of the state.
|
|
@@ -3599,6 +3607,14 @@ var Store = /** @class */ (function () {
|
|
|
3599
3607
|
return Store;
|
|
3600
3608
|
}());
|
|
3601
3609
|
if (false) {
|
|
3610
|
+
/**
|
|
3611
|
+
* This is a derived state stream that leaves NGXS execution strategy to emit state changes within the Angular zone,
|
|
3612
|
+
* because state is being changed actually within the `<root>` zone, see `InternalDispatcher#dispatchSingle`.
|
|
3613
|
+
* All selects would use this stream, and it would call leave only once for any state change across all active selectors.
|
|
3614
|
+
* @type {?}
|
|
3615
|
+
* @private
|
|
3616
|
+
*/
|
|
3617
|
+
Store.prototype._selectableStateStream;
|
|
3602
3618
|
/**
|
|
3603
3619
|
* @type {?}
|
|
3604
3620
|
* @private
|