Skip to content

[HOLD for payment 2024-05-09] [HOLD for payment 2024-05-08] HIGH: [API Reliability] [$250] Multiple calls to OpenReport on signin #39673

Closed

Description

@m-natarajan

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: 1.4.60-7
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @quinthar
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1712180869292309

Action Performed:

  1. Sign in to NewDot

Expected Result:

Only one OpenReport is called since I open it only once

Actual Result:

It is called twice

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

Screen Shot 2024-04-04 at 8 51 35 PM

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0138cc8ab53b98e8c0
  • Upwork Job ID: 1777757590524878848
  • Last Price Increase: 2024-04-16
  • Automatic offers:
    • abdulrahuman5196 | Reviewer | 0
    • bernhardoj | Contributor | 0
Issue OwnerCurrent Issue Owner: @muttmuure

Activity

  1. added
    Daily
    Bug
    on Apr 5, 2024
  2. melvin-bot commented on Apr 5, 2024

    @melvin-bot

    Triggered auto assignment to @muttmuure (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. bernhardoj commented on Apr 6, 2024

    @bernhardoj
    Contributor

    Proposal

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

    There are 2 duplicate OpenReport request when opening a report for the first time, for example after sign in.

    What is the root cause of that problem?

    The first OpenReport is called when ReportScreen is mounted (fetchReportIfNeeded).

    useEffect(() => {
    Timing.end(CONST.TIMING.CHAT_RENDER);
    Performance.markEnd(CONST.TIMING.CHAT_RENDER);
    fetchReportIfNeeded();

    The second OpenReport is called when ReportActionsView is also mounted (openReportIfNecessary).

    useEffect(() => {
    if (reportActionID) {
    return;
    }
    const interactionTask = InteractionManager.runAfterInteractions(() => {
    openReportIfNecessary();
    });

    Both openReportIfNecessary and openReportIfNecessary won't call OpenReport if shouldFetchReport is false.

    if (!shouldFetchReport(report)) {
    return;
    }

    If shouldFetchReport is true, then the difference between openReportIfNecessary and openReportIfNecessary is, fetchReportIfNeeded won't call OpenReport if the report already exists

    // It is possible that we may not have the report object yet in Onyx yet e.g. we navigated to a URL for an accessible report that
    // is not stored locally yet. If report.reportID exists, then the report has been stored locally and nothing more needs to be done.
    // If it doesn't exist, then we fetch the report from the API.
    if (report.reportID && report.reportID === reportIDFromRoute && !reportMetadata?.isLoadingInitialReportActions) {
    return;
    }

    but openReportIfNecessary will always call it.

    const openReportIfNecessary = () => {
    if (!shouldFetchReport(report)) {
    return;
    }
    Report.openReport(reportID, reportActionID);
    };

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

    First, don't call openReportIfNecessary when ReportActionsView is mounted. Then, we need to decide whether we should always call OpenReport or not when ReportScreen is mounted even when we already have the report object. I would say yes so we always get the latest report data every time we visit a chat (and also because we did this in ReportActionsView, so the behavior is unchanged).

    We can do that by removing this condition.

    if (report.reportID && report.reportID === reportIDFromRoute && !reportMetadata?.isLoadingInitialReportActions) {
    return;
    }

  4. melvin-bot commented on Apr 8, 2024

    @melvin-bot

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

  5. added
    External
    on Apr 9, 2024
  6. melvin-bot commented on Apr 9, 2024

    @melvin-bot
  7. changed the title [-]HIGH: [Reliability] Multiple calls to OpenReport on signin[/-] [+][$250] HIGH: [Reliability] Multiple calls to OpenReport on signin[/+] on Apr 9, 2024
  8. added
    Help Wanted
    on Apr 9, 2024
  9. muttmuure commented on Apr 9, 2024

    @muttmuure
    Contributor

    Adding external

  10. melvin-bot commented on Apr 9, 2024

    @melvin-bot

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

  11. 57 remaining items

  12. added
    Daily
    and removed
    Weekly
    on May 7, 2024
  13. muttmuure commented on May 8, 2024

    @muttmuure
    Contributor

    Awaiting payment date

  14. melvin-bot commented on May 13, 2024

    @melvin-bot

    @flodnv, @abdulrahuman5196, @muttmuure, @bernhardoj Eep! 4 days overdue now. Issues have feelings too...

  15. flodnv commented on May 14, 2024

    @flodnv
    Contributor

    @muttmuure can we pay and close this?

  16. muttmuure commented on May 14, 2024

    @muttmuure
    Contributor

    Automation has failed, I will create a payment in Upwork tomorrow

  17. melvin-bot commented on May 20, 2024

    @melvin-bot

    @flodnv, @abdulrahuman5196, @muttmuure, @bernhardoj Huh... This is 4 days overdue. Who can take care of this?

  18. muttmuure commented on May 21, 2024

    @muttmuure
    Contributor

    Paid

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions