Skip to content

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

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.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

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Feb 27, 2024
  2. 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[/+] on Feb 27, 2024
  3. melvin-bot commented on Feb 27, 2024

    @melvin-bot
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 27, 2024
  5. melvin-bot commented on Feb 27, 2024

    @melvin-bot

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

  6. melvin-bot commented on Feb 27, 2024

    @melvin-bot

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

  7. wildan-m commented on Feb 28, 2024

    @wildan-m
    Contributor

    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.

  8. wildan-m commented on Feb 28, 2024

    @wildan-m
    Contributor

    @mkhutornyi, @miljakljajic Proposal updated with alternative solution.

  9. brunovjk commented on Feb 28, 2024

    @brunovjk
    Contributor

    Is this the same #30147?

  10. mkhutornyi commented on Feb 29, 2024

    @mkhutornyi
    Contributor

    reviewing 1 proposal

  11. 41 remaining items

  12. wildan-m commented on Apr 17, 2024

    @wildan-m
    Contributor

    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?

  13. melvin-bot commented on Apr 18, 2024

    @melvin-bot

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

  14. melvin-bot commented on Apr 22, 2024

    @melvin-bot

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

  15. miljakljajic commented on Apr 23, 2024

    @miljakljajic
    Contributor
  16. melvin-bot commented on Apr 26, 2024

    @melvin-bot

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

  17. mvtglobally commented on Apr 29, 2024

    @mvtglobally

    Issue not reproducible during KI retests. (Second week)

  18. wildan-m commented on Apr 30, 2024

    @wildan-m
    Contributor

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

  19. miljakljajic commented on Apr 30, 2024

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions