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.52k stars 2.87k forks source link

[$250] [Dev] Console Warning: Each child in a list should have a unique “key” prop. Check the render method of MoneyRequestConfirmationListFooter #49063

Closed m-natarajan closed 1 month ago

m-natarajan commented 1 month 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.30-9 Reproducible in staging?: Needs reproduction Reproducible in production?: Needs reproduction 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: @c3024 Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1726072632778819?thread_ts=1726072125.690969&cid=C049HHMV9SM

Action Performed:

  1. Logon to ND on iOS App
  2. Go to the self DM page
  3. Start the Track Expense Flow and continue till the confirmation page

Expected Result:

No console warning on the confirmation page

Actual Result:

Console Warning, Each child in a list should have a unique “key” prop. Check the render method of MoneyRequestConfirmationListFooter

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021834465215371395617
  • Upwork Job ID: 1834465215371395617
  • Last Price Increase: 2024-09-13
  • Automatic offers:
    • gijoe0295 | Contributor | 103944812
Issue OwnerCurrent Issue Owner: @parasharrajat
melvin-bot[bot] commented 1 month ago

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

MelvinBot commented 1 month ago

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

gijoe0295 commented 1 month ago

Edited by proposal-police: This proposal was edited at 2023-11-01T12:00:00Z.

Proposal

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

Console Warning, Each child in a list should have a unique “key” prop. Check the render method of MoneyRequestConfirmationListFooter

What is the root cause of that problem?

In MoneyRequestConfirmationListFooter, we're missing key for the MentionReportContext.Provider which wraps the Description menu item:

https://github.com/Expensify/App/blob/57f8c23dec9737d9dafa4dee012b1f351a52cfa0/src/components/MoneyRequestConfirmationListFooter.tsx#L302-L304

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

Add key={translate('common.description')} to the MentionReportContext.Provider above.

RachCHopkins commented 1 month ago

@m-natarajan can you please outline the exact steps?

Go to the self DM page

What is the self DM page?

Does this mean tap Create, Start Chat and then choose the currently logged in user?

Start the Track Expense Flow and continue till the confirmation page

What is the confirmation page? I can Track an expense, then choose to categorise the expense, code it and save. I don't see anything that says "confirm".

c3024 commented 1 month ago

Apologies for the confusion. There were quite a few development warnings/errors I reported so the steps have become too generic.

Here are the exact steps

  1. Log on to New Expensify App on iOS
  2. Press on the Floating Action Button (+)
  3. Press on Track Expense
  4. Switch to the Manual tab
  5. Enter any amount
  6. Press Next

Expected Result:

There should be no console errors or warnings.

Actual Result:

Console Warning:

Each child in a list should have a unique “key” prop.
Check the render method of MoneyRequestConfirmationListFooter

This bug occurs only on development environment and cannot be recreated on staging or production versions of the app.

RachCHopkins commented 1 month ago

Ok, sounds like it's not something I can repro, but I trust you @c3024!!

melvin-bot[bot] commented 1 month ago

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

melvin-bot[bot] commented 1 month ago

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

nkdengineer commented 1 month ago

Proposal

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

Console Warning, Each child in a list should have a unique “key” prop. Check the render method of MoneyRequestConfirmationListFooter

What is the root cause of that problem?

We add the key prop for the child component instead of adding this for the outside

https://github.com/Expensify/App/blob/1a43284920954150af90b7439f8da45cb3a41716/src/components/MoneyRequestConfirmationListFooter.tsx#L303-L304

We also miss adding the key prop for the billable item here https://github.com/Expensify/App/blob/1a43284920954150af90b7439f8da45cb3a41716/src/components/MoneyRequestConfirmationListFooter.tsx#L507

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

We should move the key prop to

<MentionReportContext.Provider
    value={mentionReportContextValue}
    key={translate('common.description')}
>
    <MenuItemWithTopDescription

https://github.com/Expensify/App/blob/1a43284920954150af90b7439f8da45cb3a41716/src/components/MoneyRequestConfirmationListFooter.tsx#L303-L304

We also need to add key prop for billable option here to prevent the same bug when the billable is enabled

<View
    style={[styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, styles.ml5, styles.mr8, styles.optionRow]}
    key={translate('common.billable')}
>

https://github.com/Expensify/App/blob/1a43284920954150af90b7439f8da45cb3a41716/src/components/MoneyRequestConfirmationListFooter.tsx#L507

What alternative solutions did you explore? (Optional)

parasharrajat commented 1 month ago

@gijoe0295 proposal looks good. We should check for all elements in the loop for the key. This distinction alone does not warrant a significant change as it is something that we will check in the PR. This is only the extra point in @nkdengineer proposal.

:ribbon: :eyes: :ribbon: C+ reviewed

melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @luacmartins, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] commented 1 month ago

📣 @gijoe0295 🎉 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 📖

RachCHopkins commented 1 month ago

Automation is borked, looks like this is pretty much ready for payment. @parasharrajat can you please do the checklist?

The following checklist (instructions) will need to be completed before the issue can be closed:

Also, what's our payment date for this one?

parasharrajat commented 1 month 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:

Regression Test Steps

  1. Press FAB > Submit expense
  2. Choose a workspace with Billable enabled
  3. Proceed to confirmation page
  4. Verify Warning: Each child in a list should have a unique “key” prop does not show
  5. Press FAB > Submit expense > Distance > Start
  6. Verify Warning: Invalid prop inbetweenCompo of type boolean supplied ... does not show
  7. Verify Warning: Invalid prop listEmptyComponent of type function supplied ... does not show
  8. Verify Warning: Invalid prop listLoaderComponent of type function supplied ... does not show

Do you agree 👍 or 👎 ?

luacmartins commented 1 month ago

I don't think we need a regression test for this specifically. It doesn't really break user functionality.

RachCHopkins commented 1 month ago

Ok cool, thanks @luacmartins - I'm also not clear on when this needs to be paid out, so if you can clarify that, that would be wonderful.

gijoe0295 commented 1 month ago

@RachCHopkins PR reach production since early Sep 25. Should be ready for payment on Oct 2.

RachCHopkins commented 1 month ago

Payment Summary:

Upwork job here

RachCHopkins commented 1 month ago

Contributor has been paid, the contract has been completed, and the Upwork post has been closed.