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] Expense - In offline, on creating second split expense user not scrolled down to new expense. #54528

Open
2 of 8 tasks
IuliiaHerets opened this issue Dec 24, 2024 · 11 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Dec 24, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.0.78-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
Issue reported by: Applause Internal Team
Device used: Redmi note 10s Android 13
App Component: Money Requests

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Go offline
  3. Tap fab --start chat& Create a group chat
  4. Create a split expense
  5. Create a second split expense

Expected Result:

In offline, on creating second split expense user must be scrolled down to new expense.

Actual Result:

In offline, on creating second split expense user not scrolled down to new expense.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6701767_1735043939052.Screenrecorder-2024-12-24-17-59-30-74_compress_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021871673363207753108
  • Upwork Job ID: 1871673363207753108
  • Last Price Increase: 2024-12-31
  • Automatic offers:
    • FitseTLT | Contributor | 105536567
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 24, 2024
Copy link

melvin-bot bot commented Dec 24, 2024

Triggered auto assignment to @sakluger (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.

@FitseTLT
Copy link
Contributor

FitseTLT commented Dec 24, 2024

Edited by proposal-police: This proposal was edited at 2024-12-24 14:06:08 UTC.

Proposal

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

Expense - In offline, on creating second split expense user not scrolled down to new expense.

What is the root cause of that problem?

hasNewestReportAction is becoming false here so we are early returning without scrolling to bottom

if (!hasNewestReportActionRef.current) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
return;
}
reportScrollManager.scrollToBottom();

this is because when report prop passed to report action list is memorized here with the dependency being reportOnyx object
policyAvatar: reportOnyx.policyAvatar,
pendingChatMembers: reportOnyx.pendingChatMembers,
},
[reportOnyx, permissions],

but adding object as a dependency will only change the value on change of the object reference and in this case it is not changing and the memo is not recalculating on the change of report.lastVisibleActionCreated and up-to-date report data is not provided for ReportActionList so hasNewestReportAction will be false preventing the scroll
The reason why it is only happening for split is because we are directly getting the object reference of the object here
and directly setting/mutating the object here and directly setting the object in optimistic data here

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

We have options to solve it

  1. we can clone the report object from onyx via spreading or deep clone here
    let existingSplitChatReport = existingChatReportID ? allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${existingChatReportID}`] : null;
    let existingSplitChatReport = existingChatReportID ? {...allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${existingChatReportID}`]} : null;

and apply the same fixes if we have same problem of directly mutating onyx data and setting in optimistic data in other cases too
2. We can specifically add the prop of the reportOnyx in the dependency. To solve this issue adding the report.lastVisibleActionCreated as a dependency suffices but we need to add the other props too that we are defining in the useMemo

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

We can also directly pass the whole reportOnyx to ReportActionsView but I think we are intentionally memorizing to only re-render on only relevant data for performance reasons.

@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Dec 24, 2024
@melvin-bot melvin-bot bot changed the title Expense - In offline, on creating second split expense user not scrolled down to new expense. [$250] Expense - In offline, on creating second split expense user not scrolled down to new expense. Dec 24, 2024
Copy link

melvin-bot bot commented Dec 24, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 24, 2024
Copy link

melvin-bot bot commented Dec 24, 2024

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

Copy link

melvin-bot bot commented Dec 30, 2024

@sakluger, @getusha Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Dec 30, 2024
@sakluger
Copy link
Contributor

I think @getusha may be on vacation. I'm going to leave the issue as is for the rest of this week, if he's not back yet then we can reassign to keep things moving.

Copy link

melvin-bot bot commented Dec 31, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Jan 1, 2025

@sakluger, @getusha Still overdue 6 days?! Let's take care of this!

@getusha
Copy link
Contributor

getusha commented Jan 1, 2025

@FitseTLT's proposal looks good to me!
The RCA makes sense and the solution works well. (1st solution)
🎀 👀 🎀 C+ Reviewed

@melvin-bot melvin-bot bot removed the Overdue label Jan 1, 2025
Copy link

melvin-bot bot commented Jan 1, 2025

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 2, 2025
Copy link

melvin-bot bot commented Jan 2, 2025

📣 @FitseTLT 🎉 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 📖

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 Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

5 participants