You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the request type descriptors' payload and meta functions are being passed the raw, top-level RSAA as the action argument, instead of an action with parsed values.
For instance, if we take the example from the README:
Instead, the dispatched FSA request action has an empty object as it's payload:
// actual…{type: 'REQUEST',payload: {},}
Cause
This is because the payload function is being passed the unparsed, top-level RSAA action here:
// We can now dispatch the request FSAif(typeofrequestType.payload==='function'||typeofrequestType.meta==='function'){// top-level [RSAA] action ⌄⌄⌄⌄⌄⌄next(awaitactionWith(requestType,[action,getState()]));}else{next(requestType);}
Based on the docs, I was expecting the following:
// We can now dispatch the request FSAif(typeofrequestType.payload==='function'||typeofrequestType.meta==='function'){constparsedAction={
...action[RSAA],
method,
body,
headers,};next(awaitactionWith(requestType,[parsedAction,getState()]));}else{next(requestType);}
This behavior appears in both the master and next branches.
I'd be happy to submit a PR, if this is indeed a bug.
The text was updated successfully, but these errors were encountered:
I think it would be better if those descriptor functions were passed the pre-parsed values for a given action, so that the developer doesn't have to know internal details of how the RSAA middleware invokes these other functions (such as action.endpoint).
@mattlubner thanks for the clarification! Ah I see -- the meta properties on a REQUEST_TYPE action should be the resolved values, not the functions passed to this middleware to generate them. Is that the same page you're on? Makes sense to me!
I think v3 is going to ship without this change, but I'm open to this change in a future release
It looks like the request type descriptors'
payload
andmeta
functions are being passed the raw, top-level RSAA as theaction
argument, instead of an action with parsed values.For instance, if we take the example from the README:
The documentation implies that the above RSAA action should result in the following FSA request action being dispatched:
Instead, the dispatched FSA request action has an empty object as it's payload:
Cause
This is because the
payload
function is being passed the unparsed, top-level RSAA action here:Based on the docs, I was expecting the following:
This behavior appears in both the
master
andnext
branches.I'd be happy to submit a PR, if this is indeed a bug.
The text was updated successfully, but these errors were encountered: