Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.55k stars 2.89k forks source link

[Payment Due 09/11] [$250] Expense - Missing green unread line after marking first expense as unread in expense report #45843

Closed m-natarajan closed 1 month ago

m-natarajan commented 3 months ago

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: 9.0.10-2 Reproducible in staging?: y Reproducible in production?: n If this was caught during regression testing, add the test name, ID and link from TestRail: n/a Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause internal team Slack conversation:

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to DM.
  3. Submit two expenses to the user.
  4. Click on the expense preview to go to expense report.
  5. Right click on the first expense preview.
  6. Select Mark as unread.

Expected Result:

The line separator below "Total" will change to a green line with "New" label on the right.

Actual Result:

The line separator below "Total" disappears after marking the first expense as unread. There is no green unread line.

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

https://github.com/user-attachments/assets/fab12199-180b-42f6-ad99-bcc654454ad1

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~012c73811fb416526a
  • Upwork Job ID: 1815405989806434770
  • Last Price Increase: 2024-07-29
  • Automatic offers:
    • dominictb | Contributor | 103407584
Issue OwnerCurrent Issue Owner: @sakluger
melvin-bot[bot] commented 3 months ago

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.

melvin-bot[bot] commented 3 months ago

Triggered auto assignment to @Beamanator (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

github-actions[bot] commented 3 months ago

:wave: 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.
nyomanjyotisa commented 3 months ago

Proposal

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

Missing green unread line after marking first expense as unread in expense report

What is the root cause of that problem?

In this case we don't display the UnreadActionIndicator component because the shouldUseThreadDividerLine and isFirstVisibleReportAction value is both true https://github.com/Expensify/App/blob/f3a8f736208166286e6f7da3562f1503d5ef2a3d/src/pages/home/report/ReportActionItem.tsx#L913

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

Change this code to the following to display the UnreadActionIndicator component if only shouldDisplayNewMarker is true, since we already handled to hide the divider if the shouldHideThreadDividerLine is true. And additionally we need to pass shouldHideThreadDividerLine param to keep the space the same

{shouldDisplayNewMarker && <UnreadActionIndicator reportActionID={action.reportActionID} shouldHideThreadDividerLine={shouldHideThreadDividerLine} />}

RESULT image

What alternative solutions did you explore? (Optional)

Beamanator commented 3 months ago

@nyomanjyotisa thanks for your proposal! Can you also help us figure out what PR may have caused this bug?

melvin-bot[bot] commented 3 months ago

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

melvin-bot[bot] commented 3 months ago

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

daledah commented 3 months ago

Proposal

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

The line separator below "Total" disappears after marking the first expense as unread. There is no green unread line.

What is the root cause of that problem?

When evaluating shouldUseThreadDividerLine, we're not taking into account the shouldHideThreadDividerLine condition here. So for the first expense, it has shouldUseThreadDividerLine true and shouldHideThreadDividerLine also true, that doesn't make sense because the divider line cannot be used and hide at the same time.

This problem causes the condition here to evaluate to false, because shouldUseThreadDividerLine is true while it shouldn't be. So the unread marker does not show.

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

Check shouldHideThreadDividerLine here too. If the shouldHideThreadDividerLine is true, the shouldHideThreadDividerLine should be false because the divider line will not be used

if (shouldHideThreadDividerLine) {
    return false;
}

Optionally, we can pass shouldHideThreadDividerLine as param to UnreadActionIndicator here, to be consistent in style with the UnreadActionIndicator here

What alternative solutions did you explore? (Optional)

I think it may not be necessary (and is quite confusing) for shouldHideThreadDividerLine and shouldUseThreadDividerLine to exist as 2 different variables, because they are opposite of each other. We can consolidate them into one by combining the checks in both here and here and use them consistently throughout.

daledah commented 3 months ago

I updated the proposal to add an alternative approach to solve the issue.

dominictb commented 3 months ago

Proposal

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

The line separator below "Total" disappears after marking the first expense as unread. There is no green unread line.

What is the root cause of that problem?

In MoneyReportView, we only display the divider here so when the first expense is marked as unread, shouldHideThreadDividerLine is true and then nothing displays.

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

We should use renderThreadDivider that we used here in MoneyReportView to cover the case the first expense is unread

const renderThreadDivider = useMemo(
    () =>
        shouldHideThreadDividerLine && !isCombinedReport ? (
            <UnreadActionIndicator
                reportActionID={report.reportID}
                shouldHideThreadDividerLine={shouldHideThreadDividerLine}
            />
        ) : (
            <SpacerView
                shouldShow={!shouldHideThreadDividerLine}
                style={[!shouldHideThreadDividerLine ? styles.reportHorizontalRule : {}]}
            />
        ),
    [shouldHideThreadDividerLine, report.reportID, styles.reportHorizontalRule, isCombinedReport],
);
{(shouldShowReportField || shouldShowBreakdown || shouldShowTotal) && renderThreadDivider}

What alternative solutions did you explore? (Optional)

francoisl commented 3 months ago

Thanks for all the proposals so far. Can anyone identify what PR caused the regression though? It seems like all of suggested code changes aren't in code that changed recently.

mountiny commented 3 months ago

Demoting this because:

mountiny commented 3 months ago

@dominictb @daledah @nyomanjyotisa With any deploy blocker, always include the PR that introduced the regression

dominictb commented 3 months ago

@mountiny Thanks for your feedback. I have noted it.

While investigating, I think it's maybe related to this PR. But when I went to this PR, I saw it was deployed to production 4 days ago. So I'm not sure what PR caused this issue.

Beamanator commented 3 months ago

@allroundexperts mind reviewing this one? I'd also love to get to the bottom of how this happened, as this must have only happened recently πŸ€”

melvin-bot[bot] commented 3 months ago

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

allroundexperts commented 3 months ago

On it today.

melvin-bot[bot] commented 3 months ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

allroundexperts commented 3 months ago

Melv I'll be reviewing this today.

allroundexperts commented 3 months ago

@dominictb Can you please post a video of your solution in action? I can't seem to make it work by applying your changes.

dominictb commented 3 months ago

@allroundexperts I tested and it works well. My solution is replace the SpaceView here with renderThreadDivider

https://github.com/user-attachments/assets/616c4608-6f0e-4d38-bf83-0d963e6dc6e5

melvin-bot[bot] commented 3 months ago

@Beamanator @sakluger @allroundexperts this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

allroundexperts commented 3 months ago

Thanks for the proposals everyone!

@dominictb's proposal looks better to me as it utilises an already used piece of code in another component.

πŸŽ€ πŸ‘€ πŸŽ€ C+ reviewed

melvin-bot[bot] commented 3 months ago

Current assignee @Beamanator is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

melvin-bot[bot] commented 3 months ago

πŸ“£ @dominictb πŸŽ‰ 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 πŸ“–

melvin-bot[bot] commented 2 months ago

This issue has not been updated in over 15 days. @Beamanator, @sakluger, @allroundexperts, @dominictb eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

dominictb commented 1 month ago

@Beamanator @sakluger I think this is long ready for payment

Beamanator commented 1 month ago

Oof yep, this probably got merged & deployed when our automation was broken πŸ™ƒ

sakluger commented 1 month ago

Sorry about that!

Summarizing payment on this issue:

Contributor: @dominictb $250, paid via Upwork Contributor+: @allroundexperts $250, please request on Newdot

sakluger commented 1 month ago

@allroundexperts do we need any new regression tests?

sakluger commented 1 month ago

Pasting the BZ checklist here for convenience.

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:

[@allroundexperts] The PR that introduced the bug has been identified. Link to the PR: [@allroundexperts] 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: [@allroundexperts] 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: [@allroundexperts] Determine if we should create a regression test for this bug. [@allroundexperts] 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.

allroundexperts commented 1 month ago

Checklist

  1. I wasn't able to pinpoint the exact PR that caused this issue. It seems to me that this is something that was like this when it was first implemented.
  2. N/A
  3. N/A
  4. I think a regression test would be helpful.

Regression test

  1. Open the app and go to any direct message
  2. Submit two expenses to the user
  3. Click on the expense preview to go to expense report
  4. Right click on the first expense preview
  5. Select Mark as unread.

Verify that the line separator below "Total" will change to a green line with "New" label on the right.

Do we πŸ‘ or πŸ‘Ž ?

sakluger commented 1 month ago

Looks good to me. Thanks!

JmillsExpensify commented 4 weeks ago

$250 approved for @allroundexperts