@ngxs/store 3.8.1-dev.master-b132a8a → 3.8.1-dev.master-43ab43c

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.
@@ -48,10 +48,17 @@ function getZoneWarningMessage() {
48
48
  function getUndecoratedStateInIvyWarningMessage(name) {
49
49
  return `'${name}' class should be decorated with @Injectable() right after the @State() decorator`;
50
50
  }
51
- function getInvalidInitializationOrderMessage() {
52
- return ('You have an invalid state initialization order. This typically occurs when `NgxsModule.forFeature`\n' +
51
+ function getInvalidInitializationOrderMessage(addedStates) {
52
+ let message = 'You have an invalid state initialization order. This typically occurs when `NgxsModule.forFeature`\n' +
53
53
  'or `provideStates` is called before `NgxsModule.forRoot` or `provideStore`.\n' +
54
- 'One example is when `NgxsRouterPluginModule.forRoot` is called before `NgxsModule.forRoot`.');
54
+ 'One example is when `NgxsRouterPluginModule.forRoot` is called before `NgxsModule.forRoot`.';
55
+ if (addedStates) {
56
+ const stateNames = Object.keys(addedStates).map(stateName => `"${stateName}"`);
57
+ message +=
58
+ '\nFeature states added before the store initialization is complete: ' +
59
+ `${stateNames.join(', ')}.`;
60
+ }
61
+ return message;
55
62
  }
56
63
  function throwSelectFactoryNotConnectedError() {
57
64
  throw new Error('You have forgotten to import the NGXS module!');
@@ -1798,7 +1805,7 @@ class LifecycleStateManager {
1798
1805
  // that modules or providers are in an invalid order.
1799
1806
  action instanceof UpdateState &&
1800
1807
  !this._initStateHasBeenDispatched) {
1801
- console.error(getInvalidInitializationOrderMessage());
1808
+ console.error(getInvalidInitializationOrderMessage(action.addedStates));
1802
1809
  }
1803
1810
  }
1804
1811
  this._internalStateOperations