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.79k forks source link

[$250] [Dev] Console Warning: ERROR Warning: A props object containing a “key” prop is being spread into JSX: #49064

Open m-natarajan opened 2 weeks ago

m-natarajan commented 2 weeks 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/p1726072795900059?thread_ts=1726072125.690969&cid=C049HHMV9SM

Action Performed:

  1. Logon to ND on iOS App
  2. Go to the self DM page
  3. Track an Expense
  4. Click on Share with accountant in the whisper
  5. Continue with the flow till the merchant page.

    Expected Result:

    No console warning on the workspace merchant page.

    Actual Result:

    Console Warning ERROR Warning: A props object containing a “key” prop is being spread into JSX: let props = {key: someKey, ref: ..., valueType: ..., name: ..., defaultValue: ..., maxLength: ..., label: ..., accessibilityLabel: ..., role: ..., shouldSetTouchedOnBlurOnly: ..., blurOnSubmit: ..., onSubmitEditing: ..., returnKeyType: ..., inputID: ..., errorText: ..., value: ..., onTouched: ..., onPress: ..., onPressOut: ..., onBlur: ..., onInputChange: ...}; <ForwardRef(TextInput) {...props} />

    Workaround:

    Unknown

    Platforms:

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

    • [ ] Android: Native
    • [ ] Android: mWeb Chrome
    • [x] iOS: Native
    • [ ] iOS: mWeb Safari
    • [ ] MacOS: Chrome / Safari
    • [ ] MacOS: Desktop

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/~021836067438259125444
  • Upwork Job ID: 1836067438259125444
  • Last Price Increase: 2024-09-17
  • Automatic offers:
    • gijoe0295 | Contributor | 104010367
Issue OwnerCurrent Issue Owner: @jayeshmangwani
melvin-bot[bot] commented 2 weeks ago

Triggered auto assignment to @puneetlath (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 2 weeks ago

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

gijoe0295 commented 2 weeks ago

Edited by proposal-police: This proposal was edited at 2024-09-12 23:05:24 UTC.

Proposal

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

Console Warning: A props object containing a “key” prop is being spread into JSX

What is the root cause of that problem?

This happens in the InputWrapper where we apply spread operator for registerInput which contains key prop:

https://github.com/Expensify/App/blob/5a2602c441170093e99850e2194808218b0aa838/src/components/Form/InputWrapper.tsx#L82

https://github.com/Expensify/App/blob/d9618ca882b27714c563702c99ee9c9f6e36cde8/src/components/Form/FormProvider.tsx#L298

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

Separate the key and other props from registerInput:

const {key, ...restProps} = registerInput();
return <InputComponent key={key} {...restProps} />;

Additionally, we might need to double check every places where we use spread operator for component props to ensure they do not spread key. We can leverage the eslint-disable-next-line react/jsx-props-no-spreading lint for this case.

melvin-bot[bot] commented 1 week ago

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

melvin-bot[bot] commented 1 week ago

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

jayeshmangwani commented 1 week ago

@gijoe0295 Is this issue going to be resolved in this PR https://github.com/Expensify/App/pull/49222?

gijoe0295 commented 1 week ago

@jayeshmangwani No, this should be handled separately.

jayeshmangwani commented 1 week ago

I agree with @gijoe0295 's Proposal. We should check every spread operator used in the other components too and ensure that the key is passed separately from spread

🎀 👀 🎀 C+ reviewed

melvin-bot[bot] commented 1 week ago

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

melvin-bot[bot] commented 1 week 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 📖