ngxs-labs / data

NGXS Persistence API
https://ngxs-labs.github.io/data
81 stars 18 forks source link

State with @Persistence() decorator initialized with default value. #632

Closed floinay closed 3 years ago

floinay commented 3 years ago

Hello, i run console.log(this.snapshot) in my action after app init, but i can see empty object. In the same time in local storage my previously saved object.

splincode commented 3 years ago

Hello)) add stackblitz repro please

floinay commented 3 years ago

Hello)) add stackblitz repro please

Sorry, Stackblitz not working with your library( image

I created github repo

https://github.com/floinay/ngxs-labs-data-stackblitz

I created simple state and added simple factory method fetch, before setState() i console.log state snapthot. If APP_INIT provider exists - first value in state prints empty object every time.

https://github.com/floinay/ngxs-labs-data-stackblitz/blob/main/src/app/app.module.ts https://github.com/floinay/ngxs-labs-data-stackblitz/blob/main/src/app/tes.state.ts

floinay commented 3 years ago

@splincode Hi, can you help me?

splincode commented 3 years ago

blocked by https://github.com/ngxs-labs/data/pull/633

splincode commented 3 years ago

@floinay hi, could you please upgrade to @ngxs-labs/data@5.0.0 / @angular-ru/common@latest in your demo project?

floinay commented 3 years ago

@splincode Hi, works fine, thanks very much)

splincode commented 3 years ago

Good news)