-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: correctly check for promise in useLoadData #39
base: main
Are you sure you want to change the base?
fix: correctly check for promise in useLoadData #39
Conversation
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.
@nthurow Ran this test with how useLoadData
was written before (ie using instanceof Promise
), and it did in fact fail! I was worried we wouldn't be able to test this scenario adequately, but glad that isn't the case!
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@optum/react-hooks", | |||
"version": "1.0.4", | |||
"version": "1.0.5-next.1", |
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.
we should start looking at automating this
Proposed changes
Currently,
useLoadData
makes the assumption a promise is a native promises. Non-native promises lead to a bug where we immediately assignloadedData.result
a promise without ever evaluating that promise.The fix is to go into further depth when checking initial promise.
Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments