[Workspace Feeds]: Update isLoading both for expensify and company cards#52949
[Workspace Feeds]: Update isLoading both for expensify and company cards#52949mountiny merged 4 commits intoExpensify:mainfrom
Conversation
|
@allgandalf 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-26.at.5.35.58.PM.movAndroid: mWeb ChromeScreen.Recording.2024-11-26.at.5.37.54.PM.moviOS: NativeScreen.Recording.2024-11-26.at.5.30.53.PM.moviOS: mWeb SafariScreen.Recording.2024-11-26.at.5.32.13.PM.movMacOS: Chrome / SafariScreen.Recording.2024-11-26.at.5.16.18.PM.movMacOS: DesktopScreen.Recording.2024-11-26.at.5.27.53.PM.mov |
|
@mountiny @allgandalf Meanwhile in the CompanyCards we are just using |
|
@Expensify/design Can you please help us with how to show the loader on the company / expensify cards? I think we have three cases:
This way the problem is that if you do not have cards setup, we would be showing the loader everytime you go to the empty feature page. But at least the spinner will not show up when you already have some cards assigned. That feels like the best outcome in my opinion |
| @@ -36,7 +36,7 @@ function WorkspaceExpensifyCardPage({route}: WorkspaceExpensifyCardPageProps) { | |||
| useFocusEffect(fetchExpensifyCards); | |||
There was a problem hiding this comment.
@waterim @mountiny , 2 issues i think we need to discuss:
- On Initial login, we really would not know whether there is a feed added or there is a empty state, in this case there should be a loading indicator, which is why we introduced the PR:
- Observe that in company cards, when we reload, the state changes as follows:
a. loading indicator
b. Added feed with no card assigned (so empty modal)
c. Finally the state where we have card list.
I don't have any strong opinion about 2, but would love your inputs here.
Screen.Recording.2024-11-22.at.6.38.03.PM.mov
There was a problem hiding this comment.
Hmm, im my opinion it should work in the same way is it works for expensify cards
if cardsList is empty we are showing cardSettings.isLoading state which will be true each time we are on the page
but when cardsList has some data, even an empty {} we will not show loader here
with company cards right now we are showing loading indicator each time as our expression takes only cardFeeds.isLoading, which will be true each time were are going to this page.
Solution looks like this for companyCards:
- We can add a verification
const isLoading = !isOffline && (!cardFeeds || (cardFeeds.isLoading && !cardsList));
But here an issue comes because cardsList :>> undefined when its empty, backend returning not an empty object as it works with ExpensifyCards
|
@waterim is the PR ready for review based on design teams feeback? |
|
@waterim I think when the feed is set up, then it should return an empty object but not if there is no feed. @waterim is the current state based on how I described from functional perspective? if yes then the PR is ready to test @allgandalf |
|
Updating to make it as you described, right now no loading will be |
|
Updated behaviour @mountiny @allgandalf Screen.Recording.2024-11-26.at.00.01.37.mov |
|
@waterim there is a loading spinner everytime we open company cards when no feed is added, whereas on expensify cards page, we only show loading indicator for the very first time when we login, do you think this is expected ?: Screen.Recording.2024-11-26.at.5.17.38.PM.mov |
|
I think this is expected because we have no card settings and no card list, so we cannot know if it's because there are actually no card feeds or if it's loading - and if it's actually just loading, then showing the section would be awkward. So I think this is fine. For normal user it should not be a problem as they wont have this page just enabled without a feed and keep going there so I am fine with this |
There was a problem hiding this comment.
-
there is no cardSettings and cardList locally:
- do not have any on the policy, - loader - empty state
- we are opening the page for a first time - loader - show the card list
-
there is cardSettings and cardList present locally:
- Have some cardSetting and cardList locally, even if fetching data again - no loader
LGTM! thanks for the quick changes @waterim 🙇
|
✋ 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/mountiny in version: 9.0.67-0 🚀
|
|
Some questions about this one. Asked here. |
|
Any of the issues here should not block deploy, so checking this off. |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.67-9 🚀
|
|
|
||
| const {isOffline} = useNetwork({onReconnect: fetchCompanyCards}); | ||
| const isLoading = !isOffline && (!cardFeeds || cardFeeds.isLoading); | ||
| const isLoading = !isOffline && (!cardFeeds || (cardFeeds.isLoading && !cardsList)); |
There was a problem hiding this comment.
This was returning true with an empty object which was causing the assign card page to be shown briefly before the review request page, we fixed this in #56914
Details
Fixed Issues
$ #52909
PROPOSAL: N/A
Tests
Offline tests
Same as tests
QA Steps
None
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 */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)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
Details
Screen.Recording.2024-11-22.at.10.20.58.mov