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

[$500] Money Request grouped message jumping after adding one more Money Request #37245

Closed
1 of 6 tasks
m-natarajan opened this issue Feb 27, 2024 · 39 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@m-natarajan
Copy link

m-natarajan commented Feb 27, 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: 1.4.44-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @VickyStash
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1708959155001449

Action Performed:

  1. Open a chat with any user
  2. Create a Money Request for that user
  3. Send several text messages
  4. Create one more Money Request
  5. The grouped message will be shown at the end of the chat for a couple of seconds and then jump back to the old position

Expected Result:

Grouped Money Request message should be displayed in the order of last money request was created

Actual Result:

Grouped Money Request message jump back to the old position in the chat, though a newer money request was created

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

bug_recording.mp4
Recording.2788.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017edbff2437b3b0b7
  • Upwork Job ID: 1762291292036972544
  • Last Price Increase: 2024-03-05
@m-natarajan m-natarajan added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Feb 27, 2024
@melvin-bot melvin-bot bot changed the title Money Request grouped message jumping after adding one more Money Request [$500] Money Request grouped message jumping after adding one more Money Request Feb 27, 2024
Copy link

melvin-bot bot commented Feb 27, 2024

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

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

melvin-bot bot commented Feb 27, 2024

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

Copy link

melvin-bot bot commented Feb 27, 2024

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

@wildan-m
Copy link
Contributor

wildan-m commented Feb 28, 2024

Proposal

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

Money Request grouped messages jump after adding another Money Request and not displayed in the order of last money request was created

What is the root cause of that problem?

When money is requested, if there is an active request, it will use the existing request instead of creating a new one.

App/src/libs/actions/IOU.ts

Lines 898 to 901 in a0e444e

if (reportPreviewAction) {
reportPreviewAction = ReportUtils.updateReportPreview(iouReport, reportPreviewAction, false, comment, optimisticTransaction);
} else {
reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction);

We sort the report action by the created property which makes the preview position of the money request remains unchanged.

const sortedActions = reportActions?.filter(Boolean).sort((first, second) => {
// First sort by timestamp
if (first.created !== second.created) {
return (first.created < second.created ? -1 : 1) * invertedMultiplier;
}

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

This solution will require a backend fix to update the 'lastModified' property.

We can make modifications to the 'lastModified' here:

App/src/libs/ReportUtils.ts

Lines 3305 to 3307 in a0e444e

return {
...reportPreviewAction,
message: [

To

    const message = getReportPreviewMessage(iouReport, reportPreviewAction);
    return {
        ...reportPreviewAction,
        lastModified: DateUtils.getDBTime(),
        message: [
            {

And modify the sorting algorithm to utilize the lastModified property value (if available) for REPORTPREVIEW

Modify the following code:

const sortedActions = reportActions?.filter(Boolean).sort((first, second) => {
// First sort by timestamp
if (first.created !== second.created) {
return (first.created < second.created ? -1 : 1) * invertedMultiplier;
}

To

    const getTimestamp = (reportAction: ReportAction) =>
        reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && reportAction.lastModified
            ? reportAction.lastModified
            : reportAction.created;

    const sortedActions = reportActions?.filter(Boolean).sort((first, second) => {
        const firstTimestamp = getTimestamp(first);
        const secondTimestamp = getTimestamp(second);
        if (firstTimestamp !== secondTimestamp) {
            return (firstTimestamp < secondTimestamp ? -1 : 1) * invertedMultiplier;
        }

We can also filter by 'childType' if needed.
Branch to test

What alternative solutions did you explore? (Optional)

We can revert this PR and update the created property in the backend each time we perform updateReportPreview. Although it works, I don't recommend it since it will cause the data to lose its created date information.

Note: Reverting the PR is not necessarily indicative of a regression; it is just one way to restore the created property.

@wildan-m
Copy link
Contributor

@mkhutornyi, @miljakljajic Proposal updated with alternative solution.

@brunovjk
Copy link
Contributor

Is this the same #30147?

@melvin-bot melvin-bot bot added the Overdue label Feb 29, 2024
@mkhutornyi
Copy link
Contributor

reviewing 1 proposal

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Feb 29, 2024
@mkhutornyi
Copy link
Contributor

Clarifying the expected behavior in slack

Copy link

melvin-bot bot commented Mar 5, 2024

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

@mkhutornyi
Copy link
Contributor

🎀 👀 🎀

Copy link

melvin-bot bot commented Mar 5, 2024

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

@wildan-m
Copy link
Contributor

wildan-m commented Mar 7, 2024

@mkhutornyi @yuwenmemon

🎀 👀 🎀

What does that mean? Does it signify the acceptance of my proposal? If so, who will assist with the backend part?

@mkhutornyi
Copy link
Contributor

@wildan-m I pulled up engineer in advance to confirm the expected result. Not approved any proposals yet.

@Tony-MK
Copy link
Contributor

Tony-MK commented Mar 8, 2024

@mkhutornyi, I think this is solved based on this #36501 (comment).

@wildan-m
Copy link
Contributor

wildan-m commented Mar 8, 2024

@Tony-MK depending on which expected behavior we choose

This post expected behavior is:

Grouped Money Request message should be displayed in the order of last money request was created

I'd suggest updating the position using the lastModified prop for easier navigation. For instance, Having a pending money request buried among hundreds of subsequent chats is not only frustrating for the user but also counterproductive. It forces the user to tediously scroll up through a mountain of messages just to locate the grouped report preview. This is not an efficient use of time and can lead to important information being overlooked or forgotten. Implementing a more organized system for displaying pending requests would greatly improve the user experience and streamline communication processes.

The current behavior will also lead to this new problem.

@miljakljajic
Copy link
Contributor

Apologies - I've reopened the issue, I misunderstood this #37245 (comment) as consensus that the issue should be closed!

@wildan-m
Copy link
Contributor

wildan-m commented Apr 5, 2024

@mkhutornyi @yuwenmemon Is there any possibility of re-evaluating the expected behavior? Or what are the design/technical constraints preventing the re-arrangement of the report preview order?

@melvin-bot melvin-bot bot added the Overdue label Apr 5, 2024
Copy link

melvin-bot bot commented Apr 5, 2024

@yuwenmemon, @miljakljajic, @mkhutornyi Whoops! This issue is 2 days overdue. Let's get this updated quick!

@yuwenmemon
Copy link
Contributor

Heads up I'm going OOO through next week so @miljakljajic we might want to ping someone else to answer the question above.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 5, 2024
@miljakljajic
Copy link
Contributor

Raising the question in VIP split

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 9, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

Copy link

melvin-bot bot commented Apr 12, 2024

@yuwenmemon, @miljakljajic, @mkhutornyi Whoops! This issue is 2 days overdue. Let's get this updated quick!

@miljakljajic
Copy link
Contributor

@m-natarajan can you try to reproduce this and see if its still an issue?

@melvin-bot melvin-bot bot removed the Overdue label Apr 15, 2024
@wildan-m
Copy link
Contributor

wildan-m commented Apr 17, 2024

Yes, it still has not met the expected outcome.

Grouped Money Request message should be displayed in the order of last money request was created

Kapture.2024-04-17.at.16.25.19.mp4

@miljakljajic any response from the VIP split?

@melvin-bot melvin-bot bot added the Overdue label Apr 17, 2024
Copy link

melvin-bot bot commented Apr 18, 2024

@yuwenmemon, @miljakljajic, @mkhutornyi Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Apr 22, 2024

@yuwenmemon, @miljakljajic, @mkhutornyi 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@miljakljajic
Copy link
Contributor

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Apr 23, 2024
Copy link

melvin-bot bot commented Apr 26, 2024

@yuwenmemon, @miljakljajic, @mkhutornyi Whoops! This issue is 2 days overdue. Let's get this updated quick!

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Second week)

@wildan-m
Copy link
Contributor

@miljakljajic still no response? Perhaps you should tag engineers who are familiar with the issue.

@miljakljajic
Copy link
Contributor

I think we can close this out - it hasn't been reproducible for a while and it doesn't seem like its a high priority for split right now.

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
No open projects
Archived in project
Development

No branches or pull requests

8 participants