elgerlambert / redux-localstorage

Store enhancer that syncs (a subset) of your Redux store state to localstorage.
MIT License
1.32k stars 107 forks source link

Support Promise #6

Closed Graf009 closed 9 years ago

Graf009 commented 9 years ago

redux-localstorage 1.0.0-beta3 In persistStateMiddleware need to return a value of next (action), or I can not continue to process the promise. What do you think?

elgerlambert commented 9 years ago

Ah right, I hadn't considered that scenario. I think this also effects bufferActions.. Is it sufficient to simply return the action? Or does it have to be the value returned by next(action)?

Do you want to make a PR?

Graf009 commented 9 years ago

I can do PR, if we come up with a good solution. I'm not sure that my solution is good.

elgerlambert commented 9 years ago

I'd be happy to guide you, give it a try! Have you created a PR before?

It would be great if you could find out whether it's sufficient to return the action or whether it needs to be the value returned by next(action). If we have to return next(action) it's going to cause some complications for bufferActions I'm afraid.

Ideally we would also include a test that catches this issue, but we can take it a step at a time.

Are you using redux-promise or something else (redux-thunk perhaps)? Could you show the action creator that creates/returns the promise?

elgerlambert commented 9 years ago

Hi @Graf009, I did some work this weekend. Both persistStateMiddleware and bufferActions now return action. These changes have been pushed to `1.0-breaking-changes, should solve your issue.

Let me know if this does the trick, you can close the issue if it does.

Graf009 commented 9 years ago

Hi @elgerlambert. Yes, I know how to do PR. I use my own middleware. I checked your change in his projects, it works. Thanks forward to release 1.0

elgerlambert commented 9 years ago

Thanks @Graf009, glad to hear that the issue has been solved!