Closed catchshyam closed 5 years ago
@markwhitfeld very strange
@arturovt problem with emitter plugin?
I can confirm this happening with 3.4.0/3.4.1
This only affects Emitter plugin users. This is because of the way that Emitter inherits from Store to create an EmitStore
.
I have found the point at which the state is reset. See this stackblitz:
https://stackblitz.com/edit/ngxs-no-initial-state-debug
This bug is caused by this change in PR #791 https://github.com/ngxs/store/pull/791/files#diff-084c7b85b6562e3126b58451d5f8943aR20
Ngxs does not expect anyone to inherit from Store
and essentially run this code twice. Emitter does some things with Ngxs internals that are not usual plugin behaviours.
fixed in 3.4.2
when we have default
state and partial state coming from NgxsStoragePluginModule
default state is still coming as undefined
Store https://github.com/xmlking/ngx-starter-kit/blob/develop/libs/auth/src/lib/auth.state.ts#L31 NgxsStoragePluginModule https://github.com/xmlking/ngx-starter-kit/blob/develop/libs/core/src/lib/core.module.ts#L66
if I remove my data from LocalStorage and reload page then i see Auth Mode Changed: undefined => ImplicitFLow
@markwhitfeld
I facing the same issue as @xmlking
When state defaults are defined and the keys get stored via NgxsStoragePluginModule
the defaults are not loaded.
@xmlking Please try new version!
npm install @ngxs/store@dev
Released in 3.5.0
@splincode the issue is still reproducible in 3.7.3
I'm submitting a...
Current behavior
The feature state object is created with initial state as undefined (even when the defaults is provided).
Expected behavior
The feature state object must use the values given in defaults object definition as initial state.
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/ngxs-no-initial-state
Launch the application and click on the hyperlink in home page. Then on the console, you will see the debug message with initial state object.
Environment