support for defer: true
See original GitHub issueIn redux-async-connect
I was able to utilize a defer: true
option in order to defer the fetching of the data until after the view has transitioned. After switching to redux-connect
it seems like that use case is no longer supported.
Are there plans to add this functionality back in? My specific use case is that when I fetch an external entity I keep its data in my store along with a loaded
flag and only fetch the data if loaded
is false
. In some cases when I transition away from this entity’s view I will set its loaded
flag back to false, but not clear out the data. The result is that if I navigate back to that view I’m able to immediately display previously loaded data while the fresh data is fetched from the server, resulting in a much faster perceived page speed.
Admittedly, I’m not sure how much of that logic was built into redux-async-connect
and how much of it was manually implemented via the react-redux-universal-hot-example that my app is based off of. All I can say for sure is that when switching to redux-connect
if you navigate to a page with deferred: true
then the data loads fine if its coming from the server, but if its a page transition in the client the data never loads.
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (6 by maintainers)
Top GitHub Comments
^ That’s essentially what I ended up with and it’s been working OK for me so far.
Only difference with mine is that my linter enforces a consistent return statement so my promise is:
@jaraquistain if you supply
key
alongsidepromise
- you will be able to check loaded data easier:use
getState().reduxAsyncConnect.loadState[key]
to check for loading state, it has 3 props:Also, the response data would be stored at
getState().reduxAsyncConnect[key]
Logic for this is here: https://github.com/makeomatic/redux-connect/blob/master/modules/store.js