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.36k stars 2.78k forks source link

[HOLD for payment 2024-06-05] [$250] iOS - Expense - Chat header appears after delay when opening expense report #41523

Closed lanitochka17 closed 3 months ago

lanitochka17 commented 5 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: 1.4.70-0 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 Issue reported by: Applause - Internal Team

Action Performed:

  1. Launch New Expensify app
  2. Submit two expenses to a user with no chat history
  3. In 1:1 DM, tap on the expense preview

Expected Result:

Expense report header will appear instantly

Actual Result:

The report content is displayed first, then followed by the chat header

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/Expensify/App/assets/78819774/eef5e978-b8ae-48af-a5a9-0dcda4f7cd32

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011fdda098a71985a0
  • Upwork Job ID: 1786406953110065152
  • Last Price Increase: 2024-05-10
  • Automatic offers:
    • DylanDylann | Reviewer | 0
    • bernhardoj | Contributor | 0
Issue OwnerCurrent Issue Owner: @puneetlath
melvin-bot[bot] commented 5 months ago

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

github-actions[bot] commented 5 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.
lanitochka17 commented 5 months ago

@puneetlath FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

lanitochka17 commented 5 months ago

We think that this bug might be related to #vip-vsp

puneetlath commented 5 months ago

I'm not able to reproduce this on my iOS app.

francoisl commented 4 months ago

Can't repro either with Browserstack. I get a "Review required" violation on each expense, but that's unrelated, and violations are still in beta.

bernhardoj commented 4 months ago

Proposal

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

The money report header shows with a delay.

What is the root cause of that problem?

The money report header connects to several onyx data, https://github.com/Expensify/App/blob/0f39e4370ccd84ccf7e1647b42cb505a69a2e9a3/src/components/MoneyReportHeader.tsx#L318-L331

and if the data is not available yet, withOnyx will return null. In this case, nextStep data is not available yet.

This has the same root cause as https://github.com/Expensify/App/issues/41397

This also happens in the transaction header and the one that's not available yet is shownHoldUseExplanation https://github.com/Expensify/App/blob/0f39e4370ccd84ccf7e1647b42cb505a69a2e9a3/src/components/MoneyRequestHeader.tsx#L246-L249

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

Set an initial value of the missing data.

For the nextStep, we can set it to an empty object. https://github.com/Expensify/App/blob/0f39e4370ccd84ccf7e1647b42cb505a69a2e9a3/src/components/MoneyReportHeader.tsx#L322-L324

For the shownHoldUseExplanation, we can set it to false. https://github.com/Expensify/App/blob/0f39e4370ccd84ccf7e1647b42cb505a69a2e9a3/src/components/MoneyRequestHeader.tsx#L246-L249

However, there is currently a bug in withOnyx where a falsey initial value is ignored. I previously fixed it here to fix https://github.com/Expensify/App/issues/35906, but gets reverted because of some bugs that appear in the App where it expects the falsey initial value to not work. So, in the new PR, I use useOnyx hook instead that doesn't have this falsey initial value issue. So, we can do the same by using useOnyx here.

We can consider this as a migration issue from withOnyx to useOnyx

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

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

puneetlath commented 4 months ago

@DylanDylann thoughts on the proposal above?

DylanDylann commented 4 months ago

Will update today

DylanDylann commented 4 months ago

@bernhardoj Your proposal looks promising. Could you provide a draft branch?

bernhardoj commented 4 months ago

@DylanDylann here is the test branch

melvin-bot[bot] commented 4 months ago

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

DylanDylann commented 4 months ago

@bernhardoj As I understand we need to set the initial value:

But we can't set the initial value is false for shownHoldUseExplanation because this bug

However, there is currently a bug in withOnyx where a falsey initial value is ignored.

bernhardoj commented 4 months ago

Correct, so I used the useOnyx hook which doesn't have that bug.

mvtglobally commented 4 months ago

Issue not reproducible during KI retests. (First week)

DylanDylann commented 4 months ago

I also can't reproduce anymore, @bernhardoj Could you reproduce this issue anymore?

bernhardoj commented 4 months ago

I can still reproduce it. If you already opened the report once, then the data is already available. In that case, try to reopen the app.

https://github.com/Expensify/App/assets/50919443/85b8a911-1b1d-4cb4-862c-6b58d35ac5de

DylanDylann commented 4 months ago

@bernhardoj Yeah, a bit delay in MoneyReportHeader. But I don't see delay in MoneyRequestHeader. Could you help to confirm that?

bernhardoj commented 4 months ago

You can see the MoneyRequestHeader delay in 0:09 after the header skeleton disappears

DylanDylann commented 4 months ago

Oh see, a very small delay

DylanDylann commented 4 months ago

Your proposal works well but gives me a time to dive deep into useOnyx to understand why it resolves this problem

DylanDylann commented 4 months ago

@bernhardoj Could you explain why useOnyx will fix this issue?

bernhardoj commented 4 months ago

and if the data is not available yet, withOnyx will return null.

The important point of the issue is this. code ref

if we move from withOnyx HOC to useOnyx hook, then we won't have this problem.

DylanDylann commented 4 months ago

@bernhardoj I have a bit curious

  1. If the data is not available, what does useOnyx return?

  2. why the header is delayed when the data is not available?

bernhardoj commented 4 months ago

If the data is not available, what does useOnyx return?

It's null from my testing

why the header is delayed when the data is not available?

and if the data is not available yet, withOnyx will return null.

DylanDylann commented 4 months ago

You mean if data isn't available both withOnyx and useOnyx return null ????

bernhardoj commented 4 months ago

Yes

DylanDylann commented 4 months ago

why the header is delayed when the data is not available?

I want to ask why when the data is null, the header is delay

DylanDylann commented 4 months ago

if we move from withOnyx HOC to useOnyx hook, then we won't have this problem.

Could you help to detail your point? Why useOnyx will resolve this bug?

bernhardoj commented 4 months ago

When you render null, you see nothing. Please check the ref I put in my comment here

DylanDylann commented 4 months ago

When you render null

which null? You mean the nextStep prop? From my testing, I don't see nextStep has null value

bernhardoj commented 4 months ago

This null πŸ™‚

image
DylanDylann commented 4 months ago

Oh see, I got misunderstand your mean

DylanDylann commented 4 months ago

@bernhardoj's proposal looks good. I agree with using useOnyx instead of withOnyx πŸŽ€πŸ‘€πŸŽ€ C+ reviewed

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

πŸ“£ @DylanDylann πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reviewer role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] commented 4 months ago

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

bernhardoj commented 4 months ago

PR is ready

cc: @DylanDylann

melvin-bot[bot] commented 4 months ago

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

melvin-bot[bot] commented 4 months ago

The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.76-7 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-06-05. :confetti_ball:

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

puneetlath commented 3 months ago

@DylanDylann bump on the checklist!

DylanDylann commented 3 months ago

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:

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

Regression Test Proposal

  1. (Web/Desktop/mWeb) Refresh the app (iOS/Android) Close the app and reopen the app
  2. Verify the header/top bar of the home page/LHN is shown immediately

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

DylanDylann commented 3 months ago

@puneetlath thanks for your reminder

puneetlath commented 3 months ago

All paid. Thanks everyone!