Skip to content
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

[$250] IOU - Web - Loading spinner appears under expense every time open the expense page #45227

Closed
3 of 6 tasks
lanitochka17 opened this issue Jul 11, 2024 · 43 comments
Closed
3 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 11, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.6-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to FAB> Submit expense> Complete the flow
  2. Go to thread transaction page
  3. Go back to request page ( switch chat if needed)

Expected Result:

There should be no loading spinner when open the request page

Actual Result:

Loading spinner appears under expense every time open the request page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6538463_1720653760599.Recording__3488.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~018c260c51c3955b65
  • Upwork Job ID: 1813342162639120406
  • Last Price Increase: 2024-07-16
  • Automatic offers:
    • paultsimura | Reviewer | 103347808
    • ishpaul777 | Contributor | 103347809
Issue OwnerCurrent Issue Owner: @ishpaul777
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 11, 2024
Copy link

melvin-bot bot commented Jul 11, 2024

Triggered auto assignment to @mallenexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@mallenexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@bernhardoj
Copy link
Contributor

bernhardoj commented Jul 11, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

Loading indicator shows when we go back from a thread of the last message of a chat.

What is the root cause of that problem?

When we open a thread of the last message of a chat, then go back usign the parent link (on the header), a ReadNewestAction request is called which will show the loading indicator.

if (type === CONST.LIST_COMPONENTS.HEADER && isLoadingNewerReportActions) {
// applied for a header of the list, i.e. when you scroll to the bottom of the list
// the styles for android and the rest components are different that's why we use two different components
return (
<View style={[styles.alignItemsCenter, styles.justifyContentCenter, styles.listBoundaryLoader]}>
<ActivityIndicator
color={theme.spinner}
size="small"
/>
</View>
);

This happens after #39454. The read newest action request is triggered from this block.

if ((reportActionID && indexOfLinkedAction > -1 && !isLoadingOlderReportsFirstNeeded) || (!reportActionID && !isLoadingOlderReportsFirstNeeded)) {
handleReportActionPagination({firstReportActionID: newestReportAction?.reportActionID});
}

const handleReportActionPagination = useCallback(
({firstReportActionID}: {firstReportActionID: string}) => {
// This function is a placeholder as the actual pagination is handled by visibleReportActions
if (!hasMoreCached) {
isFirstLinkedActionRender.current = false;
fetchNewerAction(newestReportAction);
}
if (isFirstLinkedActionRender.current) {
isFirstLinkedActionRender.current = false;
}
setCurrentReportActionID(firstReportActionID);
},

Before the linked PR, we have a hasNewestReportAction in the condition. hasNewestReportAction tells us whether the last report action in the list is the newest one or not. If it's the newest one, then we don't request for read newest action. But the PR removed it because of this issue, so the read newest action request is always triggered.

Removing hasNewestReportAction works, but incomplete. We still need to prevent the read newest action request if hasNewestReportAction is true, but we need to place it correctly. To know where to put it, we need to understand what the issue is about first that caused hasNewestReportAction to be removed. To summarize it:

The issue that I linked above is that, when we link to the last action/message, sending another message won't show in the chat list. That's because isFirstLinkedActionRender is "stuck" at true, so the report actions is sliced only up to the linked action.

if (isFirstLinkedActionRender.current) {
return combinedReportActions.slice(indexOfLinkedAction);
}
const paginationSize = getInitialPaginationSize;
return combinedReportActions.slice(Math.max(indexOfLinkedAction - paginationSize, 0));

The only way to make it false is to trigger handleReportActionPagination, but it's never triggered because hasNewestReportAction is already true (remember, we linked to the last action/message).

What changes do you think we should make in order to solve the problem?

The solution is to only request for read newest action if the hasNewestReportAction is false in here.

if (!hasMoreCached) {
isFirstLinkedActionRender.current = false;
fetchNewerAction(newestReportAction);
}

This way, handleReportActionPagination will still be called and set isFirstLinkedActionRender to false while preventing read newest action request to be fired.

@bernhardoj
Copy link
Contributor

Added more explanation to the proposal

@mallenexpensify
Copy link
Contributor

@bernhardoj is this the loading spinner that's referenced in the OP?
image

@bernhardoj
Copy link
Contributor

I believe it's this one, the read new action loading indicator.

image

Copy link

melvin-bot bot commented Jul 15, 2024

@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@mallenexpensify mallenexpensify added the External Added to denote the issue can be worked on by a contributor label Jul 16, 2024
Copy link

melvin-bot bot commented Jul 16, 2024

Job added to Upwork: https://www.upwork.com/jobs/~018c260c51c3955b65

@melvin-bot melvin-bot bot changed the title IOU - Web - Loading spinner appears under expense every time open the expense page [$250] IOU - Web - Loading spinner appears under expense every time open the expense page Jul 16, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 16, 2024
Copy link

melvin-bot bot commented Jul 16, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @paultsimura (External)

@melvin-bot melvin-bot bot removed the Overdue label Jul 16, 2024
@mallenexpensify mallenexpensify removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 16, 2024
@mallenexpensify
Copy link
Contributor

@paultsimura can you attempt reproduction? If you're able to reproduce and the steps in the OP need to be updated, please outline them and I'll update the OP. I tried to reproduce yesterday and today with no luck (I think I might not have been holding it right). thx

@paultsimura
Copy link
Contributor

Hey @mallenexpensify – for me, using the steps from OP was sufficient.
The mentioned spinner is the one at the bottom of the chat as @bernhardoj outlined here.

I can reproduce it constantly:

2024-07-17.-.09.16.-.Screen.Recording.2024-07-17.at.09.13.14.mp4

If you think it's a relevant bug, I can proceed with the review.

@mallenexpensify
Copy link
Contributor

If it's a reproducible bug and we can fix it, we likely should. That said... might this be occurring anywhere else in the app? Or.. would the fix here fix/improve anything else?

@bernhardoj
Copy link
Contributor

It will fix #45387 too, which is easier to reproduce.

@mallenexpensify
Copy link
Contributor

Thanks @bernhardoj, @paultsimura plz proceed with reviewing @bernhardoj 's proposal above

@melvin-bot melvin-bot bot added the Overdue label Jul 22, 2024
Copy link

melvin-bot bot commented Jul 22, 2024

@paultsimura, @mallenexpensify Eep! 4 days overdue now. Issues have feelings too...

@mallenexpensify
Copy link
Contributor

@trjExpensify , added to Wave Collect cuz the bug occurs on the expense page. It's def polish and/or low priority.

@trjExpensify
Copy link
Contributor

We should for sure get eyes on this RCA and proposal from the crew that worked on this comment linking initiative, as it was a complex project. So, CC'ing @puneetlath @jasperhuangg @roryabraham @rayane-djouah @rushatgabhane as a few peeps mentioned in the linked issues I saw above.

Copy link

melvin-bot bot commented Jul 30, 2024

@paultsimura, @mallenexpensify Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Jul 30, 2024
@ishpaul777
Copy link
Contributor

@mallenexpensify would be great if you can assign me here, so this is on my k2

Copy link

melvin-bot bot commented Jul 31, 2024

📣 @paultsimura 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jul 31, 2024

📣 @ishpaul777 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@melvin-bot melvin-bot bot removed the Overdue label Jul 31, 2024
@paultsimura paultsimura removed their assignment Jul 31, 2024
@paultsimura
Copy link
Contributor

Unassigning myself here as @ishpaul777 will be the C+.

@ishpaul777
Copy link
Contributor

lets roll with @bernhardoj's proposal to keep this moving forward..

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Aug 1, 2024

Triggered auto assignment to @tylerkaraszewski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@bernhardoj
Copy link
Contributor

PR is ready

cc: @ishpaul777

@ishpaul777
Copy link
Contributor

This is ready for payment! 🎉

@mallenexpensify mallenexpensify removed the Reviewing Has a PR in review label Aug 26, 2024
@mallenexpensify
Copy link
Contributor

mallenexpensify commented Aug 26, 2024

Contributor: @bernhardoj owed $250 via NewDot
Contributor+: @ishpaul777 paid $250 via Upwork

Thx @ishpaul777, can you fill out the BZ checklist plz?

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@] The PR that introduced the bug has been identified. Link to the PR:
  • [@] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@] Determine if we should create a regression test for this bug.
  • [@] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@bz] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  • [ ]

@bernhardoj
Copy link
Contributor

Requested in ND.

@mallenexpensify
Copy link
Contributor

Forgot to tag @bernhardoj in the payment summary, updated.

@ishpaul777 BZ checklist plzzzzzzzz

@ishpaul777
Copy link
Contributor

On it, Sorry missed the ping before

@ishpaul777
Copy link
Contributor

Regression Test Proposal

Steps:

  1. Go to FAB> Submit expense> Complete the flow
  2. Go to thread transaction page
  3. Go back to request page.

Expected Result:
There should be no loading spinner when open the request page

Test steps 2:

  1. copy link to comment in a report
  2. visit the link.
  3. Send a new message in report.

Expected Result:
No loading indicator at the bottom

Do we agree 👍 or 👎 ?

@mallenexpensify
Copy link
Contributor

Thanks @ishpaul777 , closing, test case is here

@ishpaul777
Copy link
Contributor

ishpaul777 commented Sep 5, 2024

i think This is good to close ?

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: Done
Development

No branches or pull requests

10 participants