Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Investigate replay-based rehydration #22

Open
mridgway opened this issue Aug 23, 2014 · 8 comments
Open

Investigate replay-based rehydration #22

mridgway opened this issue Aug 23, 2014 · 8 comments

Comments

@mridgway
Copy link
Collaborator

Theoretically, stores could be reset to their original state by recording the actions and payloads that were dispatched on the server, serializing them, and then replaying them on the client to rehydrate the application. An investigation on the performance and implementation benefits for each should be done.

This could reduce the amount of code in each store since they would no longer need to implement dehydrate/rehydrate functions.

@ptomasroos
Copy link

I think is not the way to go since you retrieve a snapshot from the server. A Get req gives you a snapshot image.

And rebuild state then should be done with closer to the snapshot than try to run through a chain of effects IMHO. It will be very hard in the local what is event handler vs what shall execute business logic ect.

Plus as you said the overhead will be big for the sake of none.
When the ui has rendered all the event handling should be up as soon as possible.

@stanshillis
Copy link

Rehydrtaion of stores through replay will bring it much closer to event sourcing ideas. We are currently experimenting with replay and it works well. There are only a handful of events being replayed so performence has not been an issue. It would definitely be great to see support for that directly in the library.

@mridgway
Copy link
Collaborator Author

Yeah, I think it depends on the application, so it could be a configuration option. The implementation should be fairly simple. I'm totally willing to add this in if someone wants to do a PR.

@ptomasroos
Copy link

If the dehydrate / rehydrate methods won't go away what's the purpose ?

The goal was to reduce code right so in that case I would say there should be a single way to do the state mgmt on client side init.

But hey I'm a purist and like simplicity.

On 17 Feb 2015, at 23:06, Michael Ridgway notifications@github.com wrote:

Yeah, I think it depends on the application, so it could be a configuration option. The implementation should be fairly simple. I'm totally willing to add this in if someone wants to do a PR.


Reply to this email directly or view it on GitHub.

@mridgway
Copy link
Collaborator Author

The need for each store to define dehydrate/rehydrate would go away. With replay, it would just re-dispatch the events on the client.

@ptomasroos
Copy link

Right, It felt like you wanted both. I could def see the benefit by having a self solving rehydration.

@3den
Copy link

3den commented Feb 26, 2015

Could we add an standard dehydrate / rehydrate to the BaseStore? Those methods could just set/get this.state which is what is done in most cases.

@ptomasroos
Copy link

Elegant idea. Either that or a mixin would work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants