Odonno / ReduxSimple

Simple Stupid Redux Store using Reactive Extensions
http://www.nuget.org/packages/ReduxSimple/
MIT License
144 stars 20 forks source link

ReduxStoreWithHistory #1

Closed Odonno closed 6 years ago

Odonno commented 6 years ago
Odonno commented 6 years ago

@mhusainisurge I started writing the docs but one thing got my attention on the History feature. What if you have undone actions and then dispatch the same set of actions without using Redo function?

https://github.com/Odonno/ReduxSimple/blob/d6a5f8bb07f2415d5220cfcc30ea05360f71ca38/ReduxSimple/ReduxStoreWithHistory.cs#L56

Should we set clearFuture value to true only if the next action is different from the one in the previous timeline?

mhusainisurge commented 6 years ago

I think of this as being similar to what happens in a text editor. If you undo and then manually redo the same operation, the redo stack is not preserved. I can go either way on this, with a minor preference for the way it is.

Odonno commented 6 years ago

That's fair. Thanks for the reply.

Odonno commented 6 years ago

Hello again @mhusainisurge

I am currently writing the sample app that demonstrates how to use ReduxSimple library in a UWP application. I made some examples and one in particular is using side effects by calling a web API. This example uses the pattern with 3 actions (start asynchronous task, complete or error).

It works great but there is an issue with time travelling/history. If go back in history and then forward, the "start async task" is triggered again the API call is made which then breaks the timeline because a new action is dispatched outside of the History (when the task completed or error occured).

So, do you have an idea to fix this issue? I thought using a boolean to tell if the action is dispatched normally or if it comes from the History. But not sure if it is the best option.

Odonno commented 6 years ago

I moved the thread here #29