Loading from Redux storage does not overwrite initial state completely

78 Views Asked by At

it seems that loading from the Redux storage does not overwrite the initial state completely, and that looks like a bug for me. ( If it's not, please tell me how I can work with it productively. :) )

An example: Let's say, this is my initial state:

state = {
  ...
  test: {
    foo: 1,
  }
  ...
}

Then, in some dispatch, I change the value of test:

nextState.test = { bar: 2 };

With redux-storage set up, this is saved (I guess).

When I now close/reopen or reload the whole app, I have this state:

state = {
  ...
  test: {
    bar: 2,
    foo: 1,
  }
  ...
}

I think, there should be no foo: 1 at this point, should it?

At least it's bugging me in my app, so what's the correct way of getting rid of it? Is there a config option for redux-storage that I can set?

(See the whole code here.)

0

There are 0 best solutions below