@ngxs/store 21.0.0-dev.master-416d6de → 22.0.0-dev.master-8c6b0fc

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable, DestroyRef, NgZone, Injector, runInInjectionContext, InjectionToken, ErrorHandler, EnvironmentInjector, ɵisPromise as _isPromise, computed, makeEnvironmentProviders, provideEnvironmentInitializer, assertInInjectionContext, createEnvironmentInjector, NgModule, APP_BOOTSTRAP_LISTENER, PendingTasks, ApplicationRef } from '@angular/core';
3
3
  import { config, Observable, Subject, of, forkJoin, map, shareReplay, mergeMap, EMPTY, filter, from, isObservable, defaultIfEmpty, takeUntil, finalize, catchError, distinctUntilChanged, take, buffer, debounceTime } from 'rxjs';
4
- import { ɵwrapObserverCalls as _wrapObserverCalls, ɵOrderedSubject as _OrderedSubject, ɵStateStream as _StateStream, ɵhasOwnProperty as _hasOwnProperty, ɵmemoize as _memoize, ɵgetStoreMetadata as _getStoreMetadata, ɵgetSelectorMetadata as _getSelectorMetadata, ɵMETA_KEY as _META_KEY, ɵINITIAL_STATE_TOKEN as _INITIAL_STATE_TOKEN, ɵNgxsActionRegistry as _NgxsActionRegistry, ɵNGXS_APP_BOOTSTRAP_STATE as _NGXS_APP_BOOTSTRAP_STATE, ɵensureStoreMetadata as _ensureStoreMetadata, ɵMETA_OPTIONS_KEY as _META_OPTIONS_KEY, ɵensureSelectorMetadata as _ensureSelectorMetadata, ɵNGXS_STATE_CONTEXT_FACTORY as _NGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY as _NGXS_STATE_FACTORY } from '@ngxs/store/internals';
4
+ import { ɵwrapObserverCalls as _wrapObserverCalls, ɵOrderedSubject as _OrderedSubject, ɵStateStream as _StateStream, ɵhasOwnProperty as _hasOwnProperty, ɵmemoize as _memoize, ɵgetStoreMetadata as _getStoreMetadata, ɵgetSelectorMetadata as _getSelectorMetadata, ɵMETA_KEY as _META_KEY, ɵNGXS_DEVELOPMENT_OPTIONS as _NGXS_DEVELOPMENT_OPTIONS, ɵINITIAL_STATE_TOKEN as _INITIAL_STATE_TOKEN, ɵNgxsActionRegistry as _NgxsActionRegistry, ɵNGXS_APP_BOOTSTRAP_STATE as _NGXS_APP_BOOTSTRAP_STATE, ɵensureStoreMetadata as _ensureStoreMetadata, ɵMETA_OPTIONS_KEY as _META_OPTIONS_KEY, ɵensureSelectorMetadata as _ensureSelectorMetadata, ɵNGXS_STATE_CONTEXT_FACTORY as _NGXS_STATE_CONTEXT_FACTORY, ɵNGXS_STATE_FACTORY as _NGXS_STATE_FACTORY } from '@ngxs/store/internals';
5
5
  export { StateToken } from '@ngxs/store/internals';
6
6
  import { NGXS_PLUGINS, getActionTypeFromInstance, InitState, UpdateState, setValue, getValue, ɵisPluginClass as _isPluginClass } from '@ngxs/store/plugins';
7
7
  export { InitState, NGXS_PLUGINS, UpdateState, actionMatcher, getActionTypeFromInstance, getValue, setValue } from '@ngxs/store/plugins';
@@ -31,10 +31,10 @@ class PluginManager {
31
31
  const handlers = this._pluginHandlers || [];
32
32
  return handlers.map((plugin) => (plugin.handle ? plugin.handle.bind(plugin) : plugin));
33
33
  }
34
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: PluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
35
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: PluginManager, providedIn: 'root' });
34
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PluginManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
35
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PluginManager, providedIn: 'root' });
36
36
  }
37
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: PluginManager, decorators: [{
37
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: PluginManager, decorators: [{
38
38
  type: Injectable,
39
39
  args: [{ providedIn: 'root' }]
40
40
  }], ctorParameters: () => [] });
@@ -136,10 +136,10 @@ class InternalDispatchedActionResults extends Subject {
136
136
  this.unsubscribe();
137
137
  });
138
138
  }
139
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalDispatchedActionResults, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
140
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalDispatchedActionResults, providedIn: 'root' });
139
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalDispatchedActionResults, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
140
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalDispatchedActionResults, providedIn: 'root' });
141
141
  }
142
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalDispatchedActionResults, decorators: [{
142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalDispatchedActionResults, decorators: [{
143
143
  type: Injectable,
144
144
  args: [{ providedIn: 'root' }]
145
145
  }], ctorParameters: () => [] });
@@ -167,10 +167,10 @@ class InternalNgxsExecutionStrategy {
167
167
  }
168
168
  return func();
169
169
  }
170
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
171
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalNgxsExecutionStrategy, providedIn: 'root' });
170
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
171
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalNgxsExecutionStrategy, providedIn: 'root' });
172
172
  }
173
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalNgxsExecutionStrategy, decorators: [{
173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalNgxsExecutionStrategy, decorators: [{
174
174
  type: Injectable,
175
175
  args: [{ providedIn: 'root' }]
176
176
  }] });
@@ -210,10 +210,10 @@ class InternalActions extends _OrderedSubject {
210
210
  this.dispatched$.unsubscribe();
211
211
  });
212
212
  }
213
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalActions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
214
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalActions, providedIn: 'root' });
213
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalActions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
214
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalActions, providedIn: 'root' });
215
215
  }
216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalActions, decorators: [{
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalActions, decorators: [{
217
217
  type: Injectable,
218
218
  args: [{ providedIn: 'root' }]
219
219
  }], ctorParameters: () => [] });
@@ -243,10 +243,10 @@ class Actions extends Observable {
243
243
  observer.add(childSubscription);
244
244
  });
245
245
  }
246
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Actions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
247
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Actions, providedIn: 'root' });
246
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: Actions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
247
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: Actions, providedIn: 'root' });
248
248
  }
249
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Actions, decorators: [{
249
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: Actions, decorators: [{
250
250
  type: Injectable,
251
251
  args: [{ providedIn: 'root' }]
252
252
  }], ctorParameters: () => [] });
@@ -335,10 +335,10 @@ class InternalDispatcher {
335
335
  }
336
336
  }), shareReplay());
337
337
  }
338
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
339
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalDispatcher, providedIn: 'root' });
338
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalDispatcher, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
339
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalDispatcher, providedIn: 'root' });
340
340
  }
341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalDispatcher, decorators: [{
341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalDispatcher, decorators: [{
342
342
  type: Injectable,
343
343
  args: [{ providedIn: 'root' }]
344
344
  }] });
@@ -405,8 +405,8 @@ class NgxsConfig {
405
405
  injectContainerState: false,
406
406
  suppressErrors: false
407
407
  };
408
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
409
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => {
408
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
409
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsConfig, providedIn: 'root', useFactory: () => {
410
410
  const defaultConfig = new NgxsConfig();
411
411
  const config = inject(NGXS_OPTIONS);
412
412
  return {
@@ -419,7 +419,7 @@ class NgxsConfig {
419
419
  };
420
420
  } });
421
421
  }
422
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsConfig, decorators: [{
422
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsConfig, decorators: [{
423
423
  type: Injectable,
424
424
  args: [{
425
425
  providedIn: 'root',
@@ -503,10 +503,10 @@ class InternalStateOperations {
503
503
  // Set the state to the current + new
504
504
  stateOperations.setState({ ...currentState, ...results.defaults });
505
505
  }
506
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalStateOperations, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
507
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalStateOperations, providedIn: 'root' });
506
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalStateOperations, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
507
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalStateOperations, providedIn: 'root' });
508
508
  }
509
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalStateOperations, decorators: [{
509
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalStateOperations, decorators: [{
510
510
  type: Injectable,
511
511
  args: [{ providedIn: 'root' }]
512
512
  }] });
@@ -881,11 +881,6 @@ function jit_hasInjectableAnnotation(stateClass) {
881
881
  return annotations.some((annotation) => annotation?.ngMetadataName === 'Injectable');
882
882
  }
883
883
 
884
- const NGXS_DEVELOPMENT_OPTIONS =
885
- /* @__PURE__ */ new InjectionToken(typeof ngDevMode !== 'undefined' && ngDevMode ? 'NGXS_DEVELOPMENT_OPTIONS' : '', {
886
- factory: () => ({ warnOnUnhandledActions: true })
887
- });
888
-
889
884
  class NgxsUnhandledActionsLogger {
890
885
  /**
891
886
  * These actions should be ignored by default; the user can increase this
@@ -893,7 +888,7 @@ class NgxsUnhandledActionsLogger {
893
888
  */
894
889
  _ignoredActions = new Set([InitState.type, UpdateState.type]);
895
890
  constructor() {
896
- const options = inject(NGXS_DEVELOPMENT_OPTIONS);
891
+ const options = inject(_NGXS_DEVELOPMENT_OPTIONS);
897
892
  if (typeof options.warnOnUnhandledActions === 'object') {
898
893
  this.ignoreActions(...options.warnOnUnhandledActions.ignore);
899
894
  }
@@ -918,10 +913,10 @@ class NgxsUnhandledActionsLogger {
918
913
  : action.type;
919
914
  console.warn(`The ${action} action has been dispatched but hasn't been handled. This may happen if the state with an action handler for this action is not registered.`);
920
915
  }
921
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsUnhandledActionsLogger, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
922
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsUnhandledActionsLogger });
916
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsUnhandledActionsLogger, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
917
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsUnhandledActionsLogger });
923
918
  }
924
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsUnhandledActionsLogger, decorators: [{
919
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsUnhandledActionsLogger, decorators: [{
925
920
  type: Injectable
926
921
  }], ctorParameters: () => [] });
927
922
 
@@ -942,10 +937,10 @@ class NgxsUnhandledErrorHandler {
942
937
  // `handleError` (see `_callAndReportToErrorHandler`).
943
938
  this._ngZone.runOutsideAngular(() => this._errorHandler.handleError(error));
944
939
  }
945
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsUnhandledErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
946
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsUnhandledErrorHandler, providedIn: 'root' });
940
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsUnhandledErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
941
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsUnhandledErrorHandler, providedIn: 'root' });
947
942
  }
948
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsUnhandledErrorHandler, decorators: [{
943
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsUnhandledErrorHandler, decorators: [{
949
944
  type: Injectable,
950
945
  args: [{ providedIn: 'root' }]
951
946
  }] });
@@ -1125,7 +1120,7 @@ class StateContextFactory {
1125
1120
  }
1126
1121
  const currentAppState = root.getState();
1127
1122
  const patchOperator = simplePatch(value);
1128
- setStateFromOperator(root, currentAppState, patchOperator, path);
1123
+ setStateFromOperator(root, currentAppState, patchOperator, path, injector);
1129
1124
  },
1130
1125
  setState(value) {
1131
1126
  // Same guard as patchState — no-op if the injector is already destroyed.
@@ -1135,10 +1130,10 @@ class StateContextFactory {
1135
1130
  }
1136
1131
  const currentAppState = root.getState();
1137
1132
  if (isStateOperator(value)) {
1138
- setStateFromOperator(root, currentAppState, value, path);
1133
+ setStateFromOperator(root, currentAppState, value, path, injector);
1139
1134
  }
1140
1135
  else {
1141
- setStateValue(root, currentAppState, value, path);
1136
+ setStateValue(root, currentAppState, value, path, injector);
1142
1137
  }
1143
1138
  },
1144
1139
  dispatch(actions) {
@@ -1154,14 +1149,17 @@ class StateContextFactory {
1154
1149
  // dependency — deferring the lookup breaks the cycle.
1155
1150
  this._errorHandler ??= this._injector.get(ErrorHandler);
1156
1151
  }
1157
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StateContextFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1158
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StateContextFactory, providedIn: 'root' });
1152
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: StateContextFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1153
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: StateContextFactory, providedIn: 'root' });
1159
1154
  }
1160
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StateContextFactory, decorators: [{
1155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: StateContextFactory, decorators: [{
1161
1156
  type: Injectable,
1162
1157
  args: [{ providedIn: 'root' }]
1163
1158
  }] });
1164
- function setStateValue(root, currentAppState, newValue, path) {
1159
+ function setStateValue(root, currentAppState, newValue, path, injector) {
1160
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1161
+ warnIfNewReferenceHasIdenticalValue(injector, getState(currentAppState, path), newValue, path);
1162
+ }
1165
1163
  const newAppState = setValue(currentAppState, path, newValue);
1166
1164
  root.setState(newAppState);
1167
1165
  // Note: this returns the full app state rather than just the patched slice.
@@ -1169,14 +1167,32 @@ function setStateValue(root, currentAppState, newValue, path) {
1169
1167
  // and fixing it would be a breaking change — tracked for a future release.
1170
1168
  return newAppState;
1171
1169
  }
1172
- function setStateFromOperator(root, currentAppState, stateOperator, path) {
1170
+ function setStateFromOperator(root, currentAppState, stateOperator, path, injector) {
1173
1171
  const local = getState(currentAppState, path);
1174
1172
  const newValue = stateOperator(local);
1175
- return setStateValue(root, currentAppState, newValue, path);
1173
+ return setStateValue(root, currentAppState, newValue, path, injector);
1176
1174
  }
1177
1175
  function getState(currentAppState, path) {
1178
1176
  return getValue(currentAppState, path);
1179
1177
  }
1178
+ // Mirrors `warnOnNewReferenceWithIdenticalValue` in `Store#selectSignal`, but catches the
1179
+ // producer side: an action handler that sets a new reference with an identical value causes
1180
+ // unnecessary re-emissions for every `select()`/`selectSignal()` subscriber on this slice.
1181
+ function warnIfNewReferenceHasIdenticalValue(injector, oldValue, newValue, path) {
1182
+ if (Object.is(oldValue, newValue) || injector.destroyed)
1183
+ return;
1184
+ const warnOption = injector.get(_NGXS_DEVELOPMENT_OPTIONS, null)?.warnOnNewReferenceWithIdenticalValue;
1185
+ if (!warnOption)
1186
+ return;
1187
+ try {
1188
+ if (warnOption.isEqual(oldValue, newValue)) {
1189
+ console.error(`A new reference with an identical value was set on the "${path}" state slice. This will cause unnecessary re-emissions for subscribers relying on reference-based equality.`);
1190
+ }
1191
+ }
1192
+ catch {
1193
+ // Swallow silently.
1194
+ }
1195
+ }
1180
1196
 
1181
1197
  class InternalActionHandlerFactory {
1182
1198
  _actions = inject(InternalActions);
@@ -1246,10 +1262,10 @@ class InternalActionHandlerFactory {
1246
1262
  return result;
1247
1263
  };
1248
1264
  }
1249
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalActionHandlerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1250
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalActionHandlerFactory, providedIn: 'root' });
1265
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalActionHandlerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1266
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalActionHandlerFactory, providedIn: 'root' });
1251
1267
  }
1252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: InternalActionHandlerFactory, decorators: [{
1268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: InternalActionHandlerFactory, decorators: [{
1253
1269
  type: Injectable,
1254
1270
  args: [{ providedIn: 'root' }]
1255
1271
  }] });
@@ -1501,19 +1517,17 @@ class StateFactory {
1501
1517
  }
1502
1518
  hydrateActionMetasMap({ path, actions, instance }) {
1503
1519
  for (const actionType of Object.keys(actions)) {
1504
- const actionHandlers = actions[actionType].map(actionMeta => {
1520
+ for (const actionMeta of actions[actionType]) {
1505
1521
  const handlerFn = (ctx, action) => instance[actionMeta.fn](ctx, action);
1506
- return this._actionHandlerFactory.createActionHandler(path, handlerFn, actionMeta.options);
1507
- });
1508
- for (const actionHandler of actionHandlers) {
1509
- this._actionRegistry.register(actionType, actionHandler);
1522
+ const actionHandler = this._actionHandlerFactory.createActionHandler(path, handlerFn, actionMeta.options);
1523
+ this._actionRegistry.register(actionType, actionHandler, actionMeta.actionClass);
1510
1524
  }
1511
1525
  }
1512
1526
  }
1513
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1514
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StateFactory, providedIn: 'root' });
1527
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: StateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1528
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: StateFactory, providedIn: 'root' });
1515
1529
  }
1516
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: StateFactory, decorators: [{
1530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: StateFactory, decorators: [{
1517
1531
  type: Injectable,
1518
1532
  args: [{ providedIn: 'root' }]
1519
1533
  }], ctorParameters: () => [] });
@@ -1588,7 +1602,7 @@ class Store {
1588
1602
  if (typeof ngDevMode !== 'undefined' && ngDevMode) {
1589
1603
  return computed(() => selectorFn(this._stateStream.state()), {
1590
1604
  equal: (a, b) => {
1591
- const warnOption = this._injector?.get(NGXS_DEVELOPMENT_OPTIONS, null)?.warnOnNewReferenceWithIdenticalValue;
1605
+ const warnOption = this._injector?.get(_NGXS_DEVELOPMENT_OPTIONS, null)?.warnOnNewReferenceWithIdenticalValue;
1592
1606
  if (warnOption && !Object.is(a, b)) {
1593
1607
  try {
1594
1608
  const originalFn = selector.originalFn;
@@ -1643,10 +1657,10 @@ class Store {
1643
1657
  this._stateStream.next(initialStateValue);
1644
1658
  }
1645
1659
  }
1646
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Store, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1647
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Store, providedIn: 'root' });
1660
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: Store, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1661
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: Store, providedIn: 'root' });
1648
1662
  }
1649
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Store, decorators: [{
1663
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: Store, decorators: [{
1650
1664
  type: Injectable,
1651
1665
  args: [{ providedIn: 'root' }]
1652
1666
  }], ctorParameters: () => [] });
@@ -1827,10 +1841,10 @@ class SelectFactory {
1827
1841
  SelectFactory.config = null;
1828
1842
  });
1829
1843
  }
1830
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: SelectFactory, deps: [{ token: Store }, { token: NgxsConfig }], target: i0.ɵɵFactoryTarget.Injectable });
1831
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: SelectFactory, providedIn: 'root' });
1844
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SelectFactory, deps: [{ token: Store }, { token: NgxsConfig }], target: i0.ɵɵFactoryTarget.Injectable });
1845
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SelectFactory, providedIn: 'root' });
1832
1846
  }
1833
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: SelectFactory, decorators: [{
1847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SelectFactory, decorators: [{
1834
1848
  type: Injectable,
1835
1849
  args: [{ providedIn: 'root' }]
1836
1850
  }], ctorParameters: () => [{ type: Store }, { type: NgxsConfig }] });
@@ -1914,10 +1928,10 @@ class LifecycleStateManager {
1914
1928
  _getStateContext(mappedStore) {
1915
1929
  return this._stateContextFactory.createStateContext(mappedStore.path, this._abortController.signal);
1916
1930
  }
1917
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: LifecycleStateManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1918
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: LifecycleStateManager, providedIn: 'root' });
1931
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: LifecycleStateManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1932
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: LifecycleStateManager, providedIn: 'root' });
1919
1933
  }
1920
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: LifecycleStateManager, decorators: [{
1934
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: LifecycleStateManager, decorators: [{
1921
1935
  type: Injectable,
1922
1936
  args: [{ providedIn: 'root' }]
1923
1937
  }], ctorParameters: () => [] });
@@ -2004,11 +2018,11 @@ class NgxsRootModule {
2004
2018
  constructor() {
2005
2019
  rootStoreInitializer();
2006
2020
  }
2007
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsRootModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2008
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.2", ngImport: i0, type: NgxsRootModule });
2009
- /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsRootModule });
2021
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsRootModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2022
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: NgxsRootModule });
2023
+ /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsRootModule });
2010
2024
  }
2011
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsRootModule, decorators: [{
2025
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsRootModule, decorators: [{
2012
2026
  type: NgModule
2013
2027
  }], ctorParameters: () => [] });
2014
2028
 
@@ -2019,11 +2033,11 @@ class NgxsFeatureModule {
2019
2033
  constructor() {
2020
2034
  featureStatesInitializer();
2021
2035
  }
2022
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsFeatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2023
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.2", ngImport: i0, type: NgxsFeatureModule });
2024
- /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsFeatureModule });
2036
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsFeatureModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2037
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: NgxsFeatureModule });
2038
+ /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsFeatureModule });
2025
2039
  }
2026
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsFeatureModule, decorators: [{
2040
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsFeatureModule, decorators: [{
2027
2041
  type: NgModule
2028
2042
  }], ctorParameters: () => [] });
2029
2043
 
@@ -2091,11 +2105,11 @@ class NgxsModule {
2091
2105
  providers: getFeatureProviders(states)
2092
2106
  };
2093
2107
  }
2094
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2095
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.2", ngImport: i0, type: NgxsModule });
2096
- /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsModule });
2108
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2109
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: NgxsModule });
2110
+ /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsModule });
2097
2111
  }
2098
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsModule, decorators: [{
2112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsModule, decorators: [{
2099
2113
  type: NgModule
2100
2114
  }] });
2101
2115
 
@@ -2122,7 +2136,8 @@ function Action(actions, options) {
2122
2136
  meta.actions[type].push({
2123
2137
  fn: name,
2124
2138
  options: options || {},
2125
- type
2139
+ type,
2140
+ actionClass: action
2126
2141
  });
2127
2142
  }
2128
2143
  };
@@ -2331,13 +2346,13 @@ class ActionDirector {
2331
2346
  _actionHandlerFactory = inject(InternalActionHandlerFactory);
2332
2347
  attachAction(stateToken, Action, handlerFn, options = {}) {
2333
2348
  const actionHandler = this._actionHandlerFactory.createActionHandler(stateToken.getName(), handlerFn, options);
2334
- const detach = this._registry.register(Action.type, actionHandler);
2349
+ const detach = this._registry.register(Action.type, actionHandler, Action);
2335
2350
  return { detach };
2336
2351
  }
2337
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: ActionDirector, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2338
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: ActionDirector, providedIn: 'root' });
2352
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ActionDirector, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2353
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ActionDirector, providedIn: 'root' });
2339
2354
  }
2340
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: ActionDirector, decorators: [{
2355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: ActionDirector, decorators: [{
2341
2356
  type: Injectable,
2342
2357
  args: [{ providedIn: 'root' }]
2343
2358
  }] });
@@ -2354,21 +2369,21 @@ class NgxsDevelopmentModule {
2354
2369
  ngModule: NgxsDevelopmentModule,
2355
2370
  providers: [
2356
2371
  NgxsUnhandledActionsLogger,
2357
- { provide: NGXS_DEVELOPMENT_OPTIONS, useValue: options }
2372
+ { provide: _NGXS_DEVELOPMENT_OPTIONS, useValue: options }
2358
2373
  ]
2359
2374
  };
2360
2375
  }
2361
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsDevelopmentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2362
- /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.2", ngImport: i0, type: NgxsDevelopmentModule });
2363
- /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsDevelopmentModule });
2376
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsDevelopmentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2377
+ /** @nocollapse */ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: NgxsDevelopmentModule });
2378
+ /** @nocollapse */ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsDevelopmentModule });
2364
2379
  }
2365
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NgxsDevelopmentModule, decorators: [{
2380
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxsDevelopmentModule, decorators: [{
2366
2381
  type: NgModule
2367
2382
  }] });
2368
2383
  function withNgxsDevelopmentOptions(options) {
2369
2384
  return makeEnvironmentProviders([
2370
2385
  NgxsUnhandledActionsLogger,
2371
- { provide: NGXS_DEVELOPMENT_OPTIONS, useValue: options }
2386
+ { provide: _NGXS_DEVELOPMENT_OPTIONS, useValue: options }
2372
2387
  ]);
2373
2388
  }
2374
2389
 
@@ -2379,10 +2394,10 @@ class NoopNgxsExecutionStrategy {
2379
2394
  leave(func) {
2380
2395
  return func();
2381
2396
  }
2382
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NoopNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2383
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NoopNgxsExecutionStrategy, providedIn: 'root' });
2397
+ /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NoopNgxsExecutionStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2398
+ /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NoopNgxsExecutionStrategy, providedIn: 'root' });
2384
2399
  }
2385
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: NoopNgxsExecutionStrategy, decorators: [{
2400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NoopNgxsExecutionStrategy, decorators: [{
2386
2401
  type: Injectable,
2387
2402
  args: [{ providedIn: 'root' }]
2388
2403
  }] });