react-stack / redux-storage

Persistence layer for redux with flexible backends
MIT License
222 stars 18 forks source link

Logic of SAVE progress seems wield #2

Open Stupidism opened 7 years ago

Stupidism commented 7 years ago

Use Case

I wanted to add a middleware to modify payload to sync into storage-engine, but failed all the time.

Problem

Turnen out newState is saved into storage-engine before its action dispatched.

I think the right order should be:

  1. dispatch this SAVE action
  2. save into storage-engine in reducer or middleware.
guns2410 commented 7 years ago

What do you mean to modify payload to sync into storage-engine? Does this mean that you need your redux store to have different data than what is stored in the storage-engine?

Stupidism commented 7 years ago

No, it means I want to add redux middleware for SAVE action and modify the payload in the middleware. But failed because of the logic sequence.