Closed jjallwood closed 8 months ago
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit a5cb219bde4ef3b1f1c15784dbb8b3e01a230525:
Sandbox | Source |
---|---|
quick-install | Configuration |
fetchye-provider-install | Configuration |
fetchye-redux-provider-install | Configuration |
nextjs-fetchye-ssr | Configuration |
We have been experimenting with using
fetchye
across our tenancy, and have run into an interesting case where we want to be able to use both thedata
, and the reloadrun
methods as part of our module thunk methods. Currently we get both thedata
object and therun
method into our components via theuseFetchye
hook, we then pass these into our redux thunks as parameters. However this method is clumsy and starts to get heavy when the example includes more than one source of data (we managed to get up to 3x in one case), or when thunks begin to chain calls.This change is to export the
run
method, so both the two interfaces to Fetchye expose the same API to the client. This would allow us to re-use the underlyingmakeOneServerFetchye
methods not only in ourloadModuleData
functions, but in redux thunks to load / get / reload data without getting stuck in parameter hell.Since we have started this change the
oneFetchye
method was added tofetchye-one-app
which compliments our change allowing engineers to just dispatch their fetchye requests in their thunk.What we have today
What we would like to be able to do
Here is how we access the exported
data
,errors
andrun
response within a thunk context via ourloadContactInfo
function