Repository navigation
Conversation
# Conflicts: # src/libs/HttpUtils.ts # src/types/onyx/Response.ts
Co-authored-by: Jakub Butkiewicz <jakub.butkiewicz94@gmail.com>
rezkiy37
left a comment
There was a problem hiding this comment.
Left a comment, besides LGTM.
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-native-2023-11-21_14.24.30.mp4Android: mWeb Chromeandroid-chrome-2023-11-21_14.22.11.mp4iOS: Nativeios-native-2023-11-21_14.16.03.mp4iOS: mWeb Safariios-safari-2023-11-21_14.14.05.mp4MacOS: Chrome / Safaridesktop-chrome-2023-11-21_13.53.42.mp4MacOS: Desktopdesktop-app-2023-11-21_14.11.27.mp4 |
|
@fvlvte Any particular tests for this? |
|
@fvlvte Friendly bump to add some test steps to this, so I can check off the box 😉 |
|
@jjcoffee after investigating which parts of code it's touching, i think running of automated tests is enough - since it's using it - and the Request class aswell so in general if there's no issues in navigating trough app screens it's working good (calling API properly), i've edge cased 429 with logging in too many times, it works also good. |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24890 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
| * @returns {Promise} | ||
| */ | ||
| function processHTTPRequest(url, method = 'get', body = null, canCancel = true) { | ||
| function processHTTPRequest(url: string, method: RequestType = 'get', body: FormData | null = null, canCancel = true): Promise<Response> { |
There was a problem hiding this comment.
Shouldn't we be adding the type of canCancel as boolean?
There was a problem hiding this comment.
We don't need to explicit type this parameter because we use default value of boolean type and it will inherit the type from it.
| CONST.HTTP_STATUS.UNKNOWN_ERROR, | ||
| ]; | ||
| if (_.contains(serviceInterruptedStatuses, response.status)) { | ||
| if (serviceInterruptedStatuses.some((status) => status === response.status)) { |
There was a problem hiding this comment.
NAB but kind of clearer, no?
| if (serviceInterruptedStatuses.some((status) => status === response.status)) { | |
| if (serviceInterruptedStatuses.indexOf(response.status) > -1) { |
| * @param shouldUseSecure should we use the secure server | ||
| */ | ||
| function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) { | ||
| function xhr(command: string, data: Record<string, unknown>, type: RequestType = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise<Response> { |
There was a problem hiding this comment.
Same comment here about the boolean for shouldUseSecure
| // Do not send undefined request parameters to our API. They will be processed as strings of 'undefined'. | ||
| if (_.isUndefined(val)) { | ||
| Object.keys(data).forEach((key) => { | ||
| if (!data[key]) { |
There was a problem hiding this comment.
This is not equivalent to the old code... this will remove any 0, false, null or "" while the old code would not
There was a problem hiding this comment.
That's true, changed to typeof.
There was a problem hiding this comment.
@jjcoffee FYI since you missed this in your review and I have the feeling this would've broken a ton of things.
There was a problem hiding this comment.
Damn, good catch! Sorry for missing that 🙇
|
✋ 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/iwiznia in version: 1.4.2-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.2-3 🚀
|
Details
Migrated 'HttpUtils.js' lib to TypeScript.
Fixed Issues
$ #24890
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android-native.mov
Android: mWeb Chrome
android-chrome.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-safari.mov
MacOS: Chrome / Safari
chrome.mov
MacOS: Desktop
macos.mov