-
Notifications
You must be signed in to change notification settings - Fork 194
Handle sync requests without await #165
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,14 @@ function apiMiddleware({ getState }) { | |
} | ||
|
||
// We can now dispatch the request FSA | ||
next(await actionWith(requestType, [action, getState()])); | ||
if ( | ||
typeof requestType.payload === 'function' || | ||
typeof requestType.meta === 'function' | ||
) { | ||
next(await actionWith(requestType, [action, getState()])); | ||
} else { | ||
next(requestType); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible/worth it to add tests that verify this does happen synchronously, as expected? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's neither worth nor possible to test that this happens synchronously. Provided there is no mistake in |
||
} | ||
|
||
try { | ||
// Make the API call | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the other
requestType
properties that can be passed as functions? ie,headers
,options
orbailout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
headers
,options
orbailout
aren't properties ofrequestType
, they are properties of[RSAA]
, thus this change doesn't apply to them.