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-08-09] [$250] ‘New messages’ banner shows up every time for the sender when sending a message to a chat report #43486

Closed
2 of 6 tasks
m-natarajan opened this issue Jun 11, 2024 · 57 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@m-natarajan
Copy link

m-natarajan commented Jun 11, 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.81-8
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: @youssef-lr
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1718058418632669

Action Performed:

  1. Go to a chat report (user B) with lots of messages as user A
  2. Send a message from user A to user B

Expected Result:

New message banner should not appear for the sender (user A)

Actual Result:

‘New messages’ banner shows up every time sending a new message in a chat, the message is coming from user A

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

RPReplay_Final1718058334.MP4
TKUV5746.MP4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e44bca9dc779dfff
  • Upwork Job ID: 1803494636295070981
  • Last Price Increase: 2024-06-26
  • Automatic offers:
    • shubham1206agra | Reviewer | 102953243
    • bernhardoj | Contributor | 102953244
Issue OwnerCurrent Issue Owner: @alexpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jun 11, 2024
Copy link

melvin-bot bot commented Jun 11, 2024

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Jun 12, 2024

Proposal

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

New message floating banner shows every time adding a new message.

What is the root cause of that problem?

One of the condition that will show the new message floating banner is canScrollToNewerComments. In our case, when sending a new message, hasNewestReportAction becomes false, so canScrollToNewerComments becomes true.

const canScrollToNewerComments = !isLoadingInitialReportActions && !hasNewestReportAction && sortedReportActions.length > 25 && !isLastPendingActionIsDelete;

<FloatingMessageCounter
isActive={(isFloatingMessageCounterVisible && !!currentUnreadMarker) || canScrollToNewerComments}

hasNewestReportAction checks whether we have the newest report action or not.

const hasNewestReportAction = sortedVisibleReportActions[0]?.created === report.lastVisibleActionCreated;

When we send a new message, we optimistically update both report and report actions.

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: optimisticReport,
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`,
value: optimisticReportActions as ReportActions,
},
];

However, the component received the report optimistic update first which makes hasNewestReportAction becomes false. Later, when the component receive the report actions optimistic update, hasNewestReportAction becomes true again. Both report and report actions are received from ReportScreen.

It's because for report onyx, we use useOnyx,

const [reportOnyx, reportResult] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getReportID(route)}`, {allowStaleData: true});

and for report actions, we use withOnyx,

sortedAllReportActions: {
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getReportID(route)}`,
canEvict: false,
selector: (allReportActions: OnyxEntry<OnyxTypes.ReportActions>) => ReportActionsUtils.getSortedReportActionsForDisplay(allReportActions, true),
},

so their state update are not batched together.

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

Convert report actions from withOnyx to useOnyx.

const [sortedAllReportActions] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${getReportID(route)}`, {canEvict: false,
        selector: (allReportActions: OnyxEntry<OnyxTypes.ReportActions>) => ReportActionsUtils.getSortedReportActionsForDisplay(allReportActions, true)})

Based on @youssef-lr comment, we can convert the other withOnyx to useOnyx too.

const isSidebarLoaded = useOnyx(ONYXKEYS.IS_SIDEBAR_LOADED);
const reportNameValuePairs = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${getReportID(route)}`, {allowStaleData: true});
const reportMetadata = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${getReportID(route)}`, {initialValue: {
    isLoadingInitialReportActions: true,
    isLoadingOlderReportActions: false,
    hasLoadingOlderReportActionsError: false,
    isLoadingNewerReportActions: false,
    hasLoadingNewerReportActionsError: false,
}});
const policies = useOnyx(ONYXKEYS.COLLECTION.POLICY, {allowStaleData: true});
const betas = useBetas();

@melvin-bot melvin-bot bot added the Overdue label Jun 13, 2024
@alexpensify
Copy link
Contributor

alexpensify commented Jun 14, 2024

I'll test this one tomorrow.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jun 14, 2024
Copy link

melvin-bot bot commented Jun 17, 2024

@alexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@alexpensify
Copy link
Contributor

No update yet

@melvin-bot melvin-bot bot removed the Overdue label Jun 17, 2024
@alexpensify
Copy link
Contributor

@youssef-lr - I followed up in the Slack thread since I'm unable to replicate the experience:

2024-06-18_12-08-29

@alexpensify
Copy link
Contributor

I was able to replicate the experience if you overload a chat with a ton of activity. Also, I think the issue might be the response trying to catch up. I'm going to mark this as external, but I think @youssef-lr should be involved in the review.

2024-06-18_22-14-17.mp4

@alexpensify alexpensify added the External Added to denote the issue can be worked on by a contributor label Jun 19, 2024
Copy link

melvin-bot bot commented Jun 19, 2024

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

@melvin-bot melvin-bot bot changed the title ‘New messages’ banner shows up every time for the sender when sending a message to a chat report [$250] ‘New messages’ banner shows up every time for the sender when sending a message to a chat report Jun 19, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 19, 2024
Copy link

melvin-bot bot commented Jun 19, 2024

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

@alexpensify
Copy link
Contributor

@shubham1206agra can you please review if the proposal here will fix the issue? Thanks!

@alexpensify
Copy link
Contributor

@shubham1206agra any update regarding the proposal here? Thanks!

@melvin-bot melvin-bot bot added the Overdue label Jun 21, 2024
@shubham1206agra
Copy link
Contributor

@bernhardoj Can you create a test branch? So we can test this.

@melvin-bot melvin-bot bot removed the Overdue label Jun 22, 2024
@bernhardoj
Copy link
Contributor

@shubham1206agra here is the test branch

@youssef-lr
Copy link
Contributor

Maybe we can convert all withOnyx to useOnyx, but withOnyx has shouldDelayUpdate set to true for ReportScreen which isn't present in useOnyx, so not sure.

@bernhardoj withOnyx is now deprecated, we can safely use useOnyx here

@melvin-bot melvin-bot bot added the Overdue label Jun 24, 2024
@alexpensify
Copy link
Contributor

@bernhardoj - can you please update your proposal based on the feedback here? Thanks!

@bernhardoj
Copy link
Contributor

Updated my proposal

Copy link

melvin-bot bot commented Jul 19, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jul 19, 2024
Copy link

melvin-bot bot commented Jul 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.9-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-07-26. 🎊

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

Copy link

melvin-bot bot commented Jul 19, 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:

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jul 24, 2024
@alexpensify
Copy link
Contributor

Noted the payment date is tomorrow

@shubham1206agra
Copy link
Contributor

@alexpensify The PR was reverted and #45711 is waiting on @youssef-lr.

@alexpensify alexpensify changed the title [HOLD for payment 2024-07-26] [HOLD for payment 2024-07-25] [$250] ‘New messages’ banner shows up every time for the sender when sending a message to a chat report [$250] ‘New messages’ banner shows up every time for the sender when sending a message to a chat report Jul 26, 2024
@alexpensify alexpensify added Weekly KSv2 Reviewing Has a PR in review and removed Daily KSv2 labels Jul 26, 2024
@alexpensify
Copy link
Contributor

@shubham1206agra, thank you for that update! I've updated the GH. We will continue with the payment process after this second PR goes into production and then clears the regression period.

@alexpensify
Copy link
Contributor

Weekly Update: Waiting on #45711

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Aug 2, 2024
@melvin-bot melvin-bot bot changed the title [$250] ‘New messages’ banner shows up every time for the sender when sending a message to a chat report [HOLD for payment 2024-08-09] [$250] ‘New messages’ banner shows up every time for the sender when sending a message to a chat report Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.15-9 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-08-09. 🎊

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

Copy link

melvin-bot bot commented Aug 2, 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:

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

@alexpensify
Copy link
Contributor

I was OOO on Friday and will work on the payment process tomorrow.

@alexpensify
Copy link
Contributor

alexpensify commented Aug 12, 2024

Payouts due: 2024-08-09

Upwork job is here.

@shubham1206agra
Copy link
Contributor

@alexpensify Accepted offer

@bernhardoj
Copy link
Contributor

Requested in ND.

@alexpensify
Copy link
Contributor

I've completed the payment process in Upwork - #43486 (comment)

Closing for now since the remaining payment will be handled via Chat.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

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. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
No open projects
Status: Done
Development

No branches or pull requests

7 participants