-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fetch the bank account for reimburse expenses with offline and loading support #13368
Conversation
I still need to test on all platforms, but I'm going to open this up for an initial review. @Expensify/design would you please take a look at the offline and loading states from the web testing video and let me know if that looks good? |
@aimane-chnaif @grgia One of you needs to 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] |
I don't think we should be replacing the branded illustration for offline. |
Rather, let's just keep the original illustration there and then display the offline message below the header + illustration |
Ok I can do that, but which illustration should I use? The one for when you have a bank account connected or when it's not connected? I didn't want the illustration to give any indication of whether you had a bank account connected, since you are offline. Do we have an illustration for when you are offline? |
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.
Looks pretty good other than that isLoading flag
src/libs/actions/BankAccounts.js
Outdated
* @return {Promise} | ||
*/ | ||
function setReimbursementAccountLoading(isLoading) { | ||
return Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isLoading}); |
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.
Instead of setting isLoading
with this function we can just set it using optimisticData
in the API command
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.
At first I set it using the optimisticData, however that presented a problem when going offline and then back online on the reimburse expenses page. The isOffline
prop updates to false
before the API command is actually processed, which means that the page briefly shows stale data, and then a loading spinner, and then the correct data. Using this action I'm able to set isLoading
right away.
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.
Hmmmm... The only spot I see this function being used is right before we call openWorkspaceReimburseView
- so how would using optimisticData
in that API command not work? 🤔
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 think it's because the Network request queue doesn't process the command right away. I'll make that change and record a video tomorrow, or you could try it if you want.
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.
Oh hmmmm.... cause it's a read. So I guess we're getting blocked by a WRITE request that's hanging? Looks like that was added here: c653d1a
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.
Oh interesting, good investigation. Given that, are you happy with the current approach?
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 have no clue 😅 - maybe it's fixable or there's a way around it. I'll ask in Slack.
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.
Asked here
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 added a comment to provide some more explanation.
Perfect I'll go ahead and use that, thanks. |
Updated and ready for another review! |
Ready for another review. The Web-PR has been merged so we only need to wait until it's deployed to production to merge this PR. @aimane-chnaif would you please fill out the PR reviewer checklist? |
Sure, I will review, test and complete checklist |
Been waiting for web dev error here gone but seems not fixed yet. |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.mp4Mobile Web - Safarimsafari.mp4Desktopdesktop-old.moviOSios.mp4Androidandroid.mp4 |
@neil-marcellini please pull from latest |
Ok @aimane-chnaif I merged main and verified that mWeb is working. From what I read on Slack here contributors are not able to test mWeb and Web right now. @arosiclair would you please run those tests for me? Or any of the other reviewers can do that. |
I managed to get my ip whitelisted and test web/mWeb successfully. Added those videos and updated checklist. |
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.
LGTM 🎉
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.
LGTM! I added a comment about adding a 'to' to a comment, but it's not necessary
@@ -363,6 +363,15 @@ function openWorkspaceView() { | |||
API.read('OpenWorkspaceView'); | |||
} | |||
|
|||
/** | |||
* Set the reimbursement account loading so that it happens right away, instead of when the API command is processed. |
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.
NAB
* Set the reimbursement account loading so that it happens right away, instead of when the API command is processed. | |
* Set the reimbursement account to loading so that it happens right away, instead of when the API command is processed. |
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.
In the interest of getting this merged I'm going to pass on that change for now.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊Significant Changes To DurationThere are no entries Meaningless Changes To DurationShow entries
Show details
|
🚀 Deployed to staging by @neil-marcellini in version: 1.2.41-0 🚀
|
🚀 Deployed to staging by @neil-marcellini in version: 1.2.41-0 🚀
|
🚀 Deployed to production by @yuwenmemon in version: 1.2.41-4 🚀
|
const achState = lodashGet(this.props.reimbursementAccount, 'achData.state', ''); | ||
const hasVBA = achState === BankAccount.STATE.OPEN; | ||
|
||
if (this.props.network.isOffline) { |
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.
hi all
we forgot to add offline behavior for other pages that had connect bank account button
eg: Cards’, ‘Bills’, ‘Invoices’, ‘Travel’ etc.
because of the missed case, we created an issue here - #21186
shouldShowLoadingSpinner: false, | ||
}; | ||
|
||
this.debounceSetShouldShowLoadingSpinner = _.debounce(this.setShouldShowLoadingSpinner.bind(this), CONST.TIMING.SHOW_LOADING_SPINNER_DEBOUNCE_TIME); |
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.
Coming from #32841.
We removed the debounce
logic here, because it was not working as expected and caused the "unlock" section to blink.
cc @robertjchen @yuwenmemon @arosiclair since they are reviewing the corresponding Web PR https://github.com/Expensify/Web-Expensify/pull/35727
Details
Previously, if you added a reimbursement account, signed out, signed back in and then navigated to a workspace's "Reimburse expenses" page, the page would show that you need to connect a bank account. The problem is that we did not fetch the reimbursement account on that page so the data was stale.
I have modified
Policy.openWorkspaceReimburseView
to fetch the reimbursement account and to set it as loading while the request is in progress. I debounced updates to the loading state so that the loading spinner will not flash onto the screen briefly. I added a new componentWorkspaceReimburseSection
that will show a loading spinner, or a section indicating that the feature is not available while offline, or the appropriate reimburse expenses section depending on the reimbursement account state.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/244855
PROPOSAL: N/A
Tests
If testing locally, first check out the branch from the Web-Expensify PR,
neil-fix-hasVBA
.Offline tests
QA Steps
Same as the tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting 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)Screenshots/Videos
Web
Online
web.mov
Offline
web-offline.mov
Mobile Web - Chrome
Online
android-Chrome.mov
Offline
android-Chrome-offline.mov
Mobile Web - Safari
Online
iOS-Safari.mp4
Offline
iOS-Safari-offline.mp4
Desktop
Online
desktop.mov
Offline
desktop-offline.mov
iOS
Online
iOS.mp4
Offline
iOS-offline.mp4
Android
Online
android.mov
Offline
android-offline.mov