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

[HOLD for payment 2024-04-05] [$500] Skeleton is displayed when navigating to a transaction thread created offline #38781

Closed
6 tasks
roryabraham opened this issue Mar 21, 2024 · 37 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@roryabraham
Copy link
Contributor

roryabraham commented Mar 21, 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: 1.4.55-2
Reproducible in staging?: no
Reproducible in production?: no
Issue reported by: @youssef-lr
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1711054985550349

Action Performed:

  1. Create a chat with someone online
  2. Request money from them then navigate to the money report (click on the preview).
  3. Go offline and request again from the money report.
  4. Try to navigate to the transaction thread of the request created offline.

Expected Result:

it should display the transaction thread where we can edit the fields

Actual Result:

It shows an infinite skeleton loader

Workaround:

n/a

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

Screen.Recording.2024-03-21.at.20.56.26.1.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01694ea7e3c07bf01d
  • Upwork Job ID: 1771247582016843776
  • Last Price Increase: 2024-03-22
  • Automatic offers:
    • situchan | Reviewer | 0
@roryabraham roryabraham added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 21, 2024
@roryabraham roryabraham self-assigned this Mar 21, 2024
Copy link

melvin-bot bot commented Mar 21, 2024

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

@roryabraham
Copy link
Contributor Author

roryabraham commented Mar 21, 2024

this is reproducible on main but not staging, so will be a deploy blocker once we ship the current checklist. For that reason, I'm not marking it as external, but going to ask @perunt to investigate a fix, as there seems to be consensus in slack that this is a regression from #30269

@situchan
Copy link
Contributor

Happy to review this if C+ is needed

@roryabraham
Copy link
Contributor Author

roryabraham commented Mar 21, 2024

I found that the optimistic IOU action has a childReportID field, that does point to an optimistic chat report. That optimistic chat report has a single optimistic CREATED action So that's all as expected

@roryabraham
Copy link
Contributor Author

roryabraham commented Mar 21, 2024

shouldShowSkeleton is getting stuck as true here

image

isLoadingInitialReportActions appears to be the problem, but interestingly it's wrong in the reportMetadata as well

@roryabraham
Copy link
Contributor Author

roryabraham commented Mar 21, 2024

ok, it appears that the reportMetadata for the report in question is somehow getting deleted, and since isLoadingInitialReportActions defaults to true in ReportScreen, it's getting stuck there

edit: It appears the debug util Onyx.log just randomly stopped working for me...
edit 2: nope, it works fine I just had a filter on 🤦

@roryabraham
Copy link
Contributor Author

Did git checkout b3068864afeaedd448cb59107629fc5cb67fe009~1 and verified this is not reproducible pre-comment-linking

@roryabraham
Copy link
Contributor Author

Interestingly isLoadingInitialReportActions was getting stuck on true before, it just didn't matter because we weren't relying on it to be correct:

image

@roryabraham
Copy link
Contributor Author

and, I suppose it kind of makes sense that it would get stuck as true when we're offline, because OpenReport sets it to true in its optimisticData, then to false in its successData + failureData. So it's stuck as true, even though we're not really loading anything while we're offline

@youssef-lr
Copy link
Contributor

Interestingly isLoadingInitialReportActions was getting stuck on true before, it just didn't matter because we weren't relying on it to be correct

What has changed now?

@roryabraham
Copy link
Contributor Author

It's used in ReportScreen as part of shouldShowSkeleton:

const shouldShowSkeleton =
isLinkingToMessage || !isReportReadyForDisplay || isLoadingInitialReportActions || isLoading || (!!reportActionIDFromRoute && reportMetadata?.isLoadingInitialReportActions);

@nkdengineer
Copy link
Contributor

Proposal

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

It shows an infinite skeleton loader

What is the root cause of that problem?

We're getting reportActions to display by ReportActionsUtils.getContinuousReportActionChain function.

const currentRangeOfReportActions = ReportActionsUtils.getContinuousReportActionChain(sortedAllReportActions, reportActionIDFromRoute);

When we create a money request, report actions of transaction thread report only have a created action with pendingAction is add. It leads index is -1 and we return an empty array.

if (id) {
index = sortedReportActions.findIndex((obj) => obj.reportActionID === id);
} else {
index = sortedReportActions.findIndex((obj) => obj.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);
}
if (index === -1) {
return [];
}
let startIndex = index;
let endIndex = index;
// Iterate forwards through the array, starting from endIndex. This loop checks the continuity of actions by:

That makes isLoadingInitialReportActions is true and then the skeleton display.

const isLoadingInitialReportActions = reportActions.length === 0 && !!reportMetadata?.isLoadingInitialReportActions;

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

In here I think we should update to accept the created action, the created action is in the last of sortedReportActions so if we can't find any action it will return the created action if it exists.

index = sortedReportActions.findIndex((obj) => obj.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD || obj.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED);

index = sortedReportActions.findIndex((obj) => obj.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

What alternative solutions did you explore? (Optional)

Or in this case if index is -1 and id is empty we will return sortedReportActions itself instead of return an empty array

if (index === -1) {
return [];
}

Result

Screen.Recording.2024-03-22.at.16.10.45.mov

@nkdengineer
Copy link
Contributor

@roryabraham What do you think about my proposal?

@roryabraham
Copy link
Contributor Author

thanks @nkdengineer, good investigation. Your proposal LGTM 👍🏼

@roryabraham
Copy link
Contributor Author

I did a bit of extra refactoring to rename some variables and improve some comments in https://github.com/Expensify/App/pull/38825/files. If possible can I request that you include these changes in your PRs as well? 🙇🏼

@nkdengineer
Copy link
Contributor

If possible can I request that you include these changes in your PRs as well? 🙇🏼

@roryabraham Sure.

@roryabraham
Copy link
Contributor Author

since #30269 is now on staging, I'm marking this as a deploy blocker

@roryabraham roryabraham added DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 and removed Daily KSv2 labels Mar 22, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@roryabraham
Copy link
Contributor Author

@nkdengineer let me know when I can expect a PR. Thanks!

Copy link

melvin-bot bot commented Mar 22, 2024

Current assignee @roryabraham is eligible for the Engineering assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Mar 22, 2024
Copy link

melvin-bot bot commented Mar 22, 2024

📣 @situchan 🎉 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 Mar 22, 2024

📣 @nkdengineer You have been assigned to this job!
Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
Keep in mind: Code of Conduct | Contributing 📖

@nkdengineer
Copy link
Contributor

@roryabraham @situchan the PR is ready for review.

Copy link

melvin-bot bot commented Mar 23, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@roryabraham
Copy link
Contributor Author

Verified this is fixed:

web.mov

so now all that's needed is payment:

@roryabraham roryabraham removed the DeployBlockerCash This issue or pull request should block deployment label Mar 23, 2024
@lschurr
Copy link
Contributor

lschurr commented Mar 25, 2024

Great! PR is here: #38829 - We'll issue payments 7 days after it's deployed to Prod.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Mar 29, 2024
@melvin-bot melvin-bot bot changed the title [$500] Skeleton is displayed when navigating to a transaction thread created offline [HOLD for payment 2024-04-05] [$500] Skeleton is displayed when navigating to a transaction thread created offline Mar 29, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.57-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-04-05. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Mar 29, 2024

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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@lschurr] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@lschurr
Copy link
Contributor

lschurr commented Apr 5, 2024

Payment summary:

@lschurr
Copy link
Contributor

lschurr commented Apr 5, 2024

@nkdengineer - Can you send me your Upwork profile or apply to the job directly here? https://www.upwork.com/ab/applicants/1771247582016843776

@nkdengineer
Copy link
Contributor

@lschurr Below's my Upwork profile!

https://www.upwork.com/freelancers/~0134d0b74faef1a5ac

@lschurr
Copy link
Contributor

lschurr commented Apr 10, 2024

Great! I sent the offer in Upwork @nkdengineer - https://www.upwork.com/nx/wm/offer/101804520

@lschurr
Copy link
Contributor

lschurr commented Apr 12, 2024

This is complete.

@lschurr lschurr closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Done
Development

No branches or pull requests

5 participants