Skip to content

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

Closed

Description

@lanitochka17

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

Activity

  1. added
    Daily
    Bug
    on Jul 11, 2024
  2. melvin-bot commented on Jul 11, 2024

    @melvin-bot

    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.

  3. lanitochka17 commented on Jul 11, 2024

    @lanitochka17
    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

  4. lanitochka17 commented on Jul 11, 2024

    @lanitochka17
    Author

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

  5. bernhardoj commented on Jul 11, 2024

    @bernhardoj
    Contributor

    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.

  6. bernhardoj commented on Jul 11, 2024

    @bernhardoj
    Contributor

    Added more explanation to the proposal

  7. mallenexpensify commented on Jul 12, 2024

    @mallenexpensify
    Contributor

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

  8. bernhardoj commented on Jul 12, 2024

    @bernhardoj
    Contributor

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

    image
  9. melvin-bot commented on Jul 15, 2024

    @melvin-bot

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

  10. added
    External
    on Jul 16, 2024
  11. melvin-bot commented on Jul 16, 2024

    @melvin-bot
  12. 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[/+] on Jul 16, 2024
  13. 39 remaining items

  14. bernhardoj commented on Aug 4, 2024

    @bernhardoj
    Contributor

    PR is ready

    cc: @ishpaul777

  15. ishpaul777 commented on Aug 26, 2024

    @ishpaul777
    Contributor

    This is ready for payment! 🎉

  16. removed
    Reviewing
    on Aug 26, 2024
  17. mallenexpensify commented on Aug 26, 2024

    @mallenexpensify
    Contributor

    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:
    • [ ]
  18. bernhardoj commented on Aug 30, 2024

    @bernhardoj
    Contributor

    Requested in ND.

  19. mallenexpensify commented on Aug 30, 2024

    @mallenexpensify
    Contributor

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

    @ishpaul777 BZ checklist plzzzzzzzz

  20. ishpaul777 commented on Aug 30, 2024

    @ishpaul777
    Contributor

    On it, Sorry missed the ping before

  21. ishpaul777 commented on Aug 30, 2024

    @ishpaul777
    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 👎 ?

  22. mallenexpensify commented on Aug 30, 2024

    @mallenexpensify
    Contributor
  23. ishpaul777 commented on Sep 5, 2024

    @ishpaul777
    Contributor

    i think This is good to close ?

  24. JmillsExpensify commented on Sep 6, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugExternalWeekly

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions