Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skipDispatch option #49

Closed
af opened this issue Jan 14, 2016 · 7 comments
Closed

skipDispatch option #49

af opened this issue Jan 14, 2016 · 7 comments

Comments

@af
Copy link
Contributor

af commented Jan 14, 2016

skipDispatch is listed as an option in the Readme, but it's not in the code anywhere. Not sure if this was removed?

Also I'm wondering if the plan is still to not dispatch the REHYDRATE actions when v2.0 lands? Alternately, is there any recommended pattern for delaying the loading/rendering of the rest of an app until persist/COMPLETE is fired?

@rt2zz
Copy link
Owner

rt2zz commented Jan 14, 2016

good catch. it was renamed to skipRestore. There are multiple options for delaying the rendering, and this is in fact the reason skipRestore was added.

Option 1: getStoredState w/ callback
Option 2: App.js lifecycle hooks
Option 3: Set a piece of state rehydrated: true in response to REHYDRATE_COMPLETE action.

Not sure the best option for your use case. I typically like option 3 but it does require wiring up your reducer appropriately

@rt2zz
Copy link
Owner

rt2zz commented Jan 14, 2016

btw just updated the readme with skipRestore

@af
Copy link
Contributor Author

af commented Jan 14, 2016

Thanks! Not sure how I missed getStoredState()

@af af closed this as completed Jan 14, 2016
@rt2zz
Copy link
Owner

rt2zz commented Jan 14, 2016

@af its a new api that honestly I am uncertain about right now. Let me know how it feels for you - it could potentially become the recommended usage.

@af
Copy link
Contributor Author

af commented Jan 14, 2016

One potential issue with it for me is that I export my persister (the output of persistStore()) so I can purge the store elsewhere. AFAIK having persistStore() in a callback means I can't export it anymore using ES6 modules. I haven't tried any workarounds for this yet, but one of your other two approaches may work for me anyways.

@rt2zz
Copy link
Owner

rt2zz commented Jan 14, 2016

hm yes no super elegant way to export persistor in this scenario. I will think about it. I would say option 3 will always give you the most optionality albeit at a certain effort to implement.

@af
Copy link
Contributor Author

af commented Jan 15, 2016

Yeah I've gone with option 3, was very easy and seems to do what I need. Thanks again for your suggestions!

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

No branches or pull requests

2 participants