-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Apply Onyx failureData on fetch failure #27650
Conversation
09b7377
to
fbaaac8
Compare
@marcaaron would love your review of this solution |
cc @tgolen since we discussed this |
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.
The rest looks fine to me. I'd love to have you look at this too @marcaaron
@@ -16,19 +16,12 @@ const requestsToIgnoreLastUpdateID = ['OpenApp', 'ReconnectApp', 'GetMissingOnyx | |||
function SaveResponseInOnyx(requestResponse, request) { | |||
return requestResponse.then((response) => { | |||
// Make sure we have response data (i.e. response isn't a promise being passed down to us by a failed retry request and response undefined) | |||
if (!response) { | |||
if (!response && !request.successData && !request.failureData) { | |||
return; |
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.
I wonder if we should return
Promise.resolve()` here to be consistent.
Just to go back to the linked issue for a second and hope to understand the problem better...
Why is the response undefined and how does it fail? |
It seems like this fetch call fails and we don't catch it |
if (!response) { | ||
return; | ||
} | ||
return requestResponse.then((response = {}) => { | ||
const onyxUpdates = response.onyxData; |
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.
I wonder if there's case of response = null
, which will make crash on this line.
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.
I haven't come across that case yet since I've only seen response = undefined or an actual response object. I could add the null check back if we think it's valuable
It was difficult for me to test App/src/libs/actions/PaymentMethods.js Lines 46 to 52 in 7f063c7
Before fix: before.movAfter fix: after.mov |
@puneetlath Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
1ec33c5
Had to resolve conflicts. Ready for review again. |
Lint failing |
Fixed styles 😢 |
Well, that was a nice and simple fix |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.78-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.78-4 🚀
|
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.79-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
Details
Coming from this comment, we fail to apply Onyx failureData if the fetch request fails because response is undefined and we return early in the code.
Fixed Issues
$ #26143
Tests
Offline tests
Covered above
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android