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

Expense - Expense preview displays "fragment.text" when the expense is invalid #50553

Closed
6 tasks done
IuliiaHerets opened this issue Oct 10, 2024 · 10 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering

Comments

@IuliiaHerets
Copy link

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.47-1
Reproducible in staging?: Y
Reproducible in production?: N
Email or phone of affected tester (no customers): applausetester+pso@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with Expensifail account.
  3. Submit an expense to any user.
  4. Send a message to the same user.
  5. Open another report and send a message.
  6. Go to Account settings > Troubleshoot > Clear cache and restart.
  7. Select Reset and refresh.
  8. Submit another expense to the user in Step 3 via FAB (do not open the chat with that user).

Expected Result:

Expense preview will still display the sender & receiver name when the expense is invalid.

Actual Result:

Expense preview displays "fragment.text" when the expense is invalid.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6630207_1728522633705!Screenshot_2024-10-10_at_09 07 04
Bug6630207_1728522633711.20241010_090508.mp4

View all open jobs on GitHub

@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Oct 10, 2024
Copy link

melvin-bot bot commented Oct 10, 2024

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

Copy link

melvin-bot bot commented Oct 10, 2024

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

Copy link

melvin-bot bot commented Oct 10, 2024

💬 A slack conversation has been started in #expensify-open-source

@melvin-bot melvin-bot bot added the Daily KSv2 label Oct 10, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Oct 10, 2024
Copy link
Contributor

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

@lakchote
Copy link
Contributor

It's directly related to #50341

cc @grgia @puneetlath @eh2077

Screen.Recording.2024-10-10.at.13.03.24.mov

@bernhardoj
Copy link
Contributor

Proposal

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

Report preview display name text shows fragment.text when the report is invalid.

What is the root cause of that problem?

I don't know why the report becomes invalid when requesting a new expense after Clear cache and restart, but I want to focus on the specific issue we have, that is the fragment.text shows.

In ReportActionItemFragment, if the type is empty, then we show fragment.text.

default:
return <Text>fragment.text</Text>;

When the report becomes invalid, the report preview action has an undefined person.
Screenshot 2024-10-10 at 19 00 40

This causes the array here to contain undefined as the item. [undefined]

const personArray = useMemo(() => {
const baseArray = displayName
? [
{
type: 'TEXT',
text: displayName,
},
]
: [action?.person?.at(0)] ?? [];

Then, we map the array here and pass the fragment type with empty string as the fallback. Because the array item is undefined, the type is also undefined, so empty string is passed.

{personArray.map((fragment, index) => (
<ReportActionItemFragment
style={[styles.flex1]}
// eslint-disable-next-line react/no-array-index-key
key={`person-${action?.reportActionID}-${index}`}
accountID={actorAccountID ?? -1}
fragment={{...fragment, type: fragment?.type ?? '', text: fragment?.text ?? ''}}

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

I believe what we want to do here is that, if the person is undefined, then return an empty array. To do that, we need to update the code to

const person = action?.person?.at(0);
const baseArray = displayName
    ? [
            {
                type: 'TEXT',
                text: displayName,
            },
        ]
    : person ? [person] : [];

OR

const baseArray = displayName
    ? [
            {
                type: 'TEXT',
                text: displayName,
            },
        ]
    : [action?.person?.at(0)].filter(Boolean);

OR

Instead of fallback to empty string, fallback it to TEXT.

fragment={{...fragment, type: fragment?.type ?? '', text: fragment?.text ?? ''}}

or just do both.

This will show an empty text.
Screenshot 2024-10-10 at 19 09 15

@lakchote
Copy link
Contributor

lakchote commented Oct 10, 2024

Thanks @bernhardoj for your proposal.

However, I'll be asking for a revert since I don't have the whole context here and it's tied to another blocker (#50547), and @grgia is OOO.

@mountiny
Copy link
Contributor

mountiny commented Oct 10, 2024

Revert PR was merged #50557 assigning Georgia so you dont loose track of this

@grgia
Copy link
Contributor

grgia commented Oct 14, 2024

👀

@grgia
Copy link
Contributor

grgia commented Oct 14, 2024

Closing out since we reverted the PR and I've addressed in a follow up (and this bug technically doesn't exist anymore)

@grgia grgia closed this as completed Oct 14, 2024
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 Engineering
Projects
Status: Done
Development

No branches or pull requests

6 participants