jmreidy / fluxy

An implementation of Facebook's Flux architecture
232 stars 19 forks source link

Question: How would you handle a saving of a store #21

Closed jakecraige closed 6 years ago

jakecraige commented 9 years ago

I have a store of options and I want to save them to localStorage. I am trying to do this on a form submit. So I'm dispatching a save action to handle this. Ideally I'd be able to return a promise from a serviceAction that does the save. The problem I'm finding is that I need access to the data in the store as that is what I want to save. The only thing I could do now is to pass it in to the save method, but that seems unnecessary since the store already has it.

How would you go about this using fluxy?

jmreidy commented 9 years ago

Right now, renderStateToString will serialize the entire store data graph. It should be trivial to change the method signature to pass in the specific store that you want to serialize. If you want to open a PR with an update for that, I'll go ahead and update. Let me know if that solution doesn't fit your needs, or if you need any guidance on the PR!