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.16k stars 2.65k forks source link

[$500] Request - App displays extra line below description when we use enter to save the description #28181

Closed kbecciv closed 8 months ago

kbecciv commented 10 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!


Action Performed:

  1. Open the app
  2. Open request money report or raise new request and open the report
  3. Open description
  4. Make some changes and press enter to save
  5. Observe that app displays cursor in new line before saving the description

Expected Result:

App should not add new line on enter in description as enter is used to save the description

Actual Result:

App adds new line in description and also triggers save when we open description and use enter to save the description

Workaround:

Unknown

Platforms:

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

Version Number: 1.3.74.0 Reproducible in staging?: y Reproducible in production?: y 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 Notes/Photos/Videos: Any additional supporting documentation

https://github.com/Expensify/App/assets/93399543/9bdff803-c9f8-4ae6-a847-74224b831c6a

image (52)

https://github.com/Expensify/App/assets/93399543/79576b1e-29d3-4462-a10a-892afa813ef3

Expensify/Expensify Issue URL: Issue reported by: @dhanashree-sawant Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1695464573868509

View all open jobs on GitHub

melvin-bot[bot] commented 10 months ago

Triggered auto assignment to @adelekennedy (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

melvin-bot[bot] commented 10 months ago

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

melvin-bot[bot] commented 10 months ago

Bug0 Triage Checklist (Main S/O)

melvin-bot[bot] commented 10 months ago

Triggered auto assignment to @alexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

melvin-bot[bot] commented 10 months ago

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

micahelchan623 commented 10 months ago

Proposal

Please re-state the issue App adds new line in description and also triggers save when we open description and use enter to save the description

What is the root cause of the problem? The root cause of having an extra line added when pressing Enter in a TextInput component is the default behavior of multiline text inputs line. By default, when the Enter key is pressed, a newline character (\n) is inserted into the text input value, resulting in a new line being created.

What changes do you think should be made to fix this problem? Options1. remove \n when on submit

 <EditRequestDescriptionPage
          defaultDescription={transactionDescription}
          onSubmit={(transactionChanges) => {
              // In case the comment hasn't been changed, do not make the API request.
              if (transactionChanges.comment.trim() === transactionDescription) {
                  Navigation.dismissModal();
                  return;
              }
              editMoneyRequest({comment: transactionChanges.comment.trim.()replace(/\n$/, '')}); // add code here
          }}
      />

P.S: depends on the scope, you can also remove the \n on Form to align the behavior across the app

What other alternative options did you explore? (Optional)

melvin-bot[bot] commented 10 months ago

📣 @micahelchan623! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
micahelchan623 commented 10 months ago

Contributor details Your Expensify account email: michaeltsang623@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01ee8267303b35d44b

melvin-bot[bot] commented 10 months ago

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

saranshbalyan-1234 commented 10 months ago

Proposal

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

Upon pressing enter on the description, it enters a new line while submitting the form.

What is the root cause of that problem?

The root cause is we are not preventing th default functionality of enter button. We have just added a new functionality that enter button should do this over here. https://github.com/Expensify/App/blob/e18ec42511682c1379710b7622b55957aaca20a7/src/components/FormSubmit/index.js#L29-L33

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

The only change we have to do it to prevent the default functionality of the enter button which can be done easily by

    if (tagName === 'TEXTAREA' && lodashGet(event, 'target.dataset.submitOnEnter', 'false') === 'true') {
            event.preventDefault();
            onSubmit();
            return;
        }

What alternative solutions did you explore? (Optional)

N/A

abdulrahuman5196 commented 10 months ago

Will review in couple of hours

abdulrahuman5196 commented 10 months ago

@saranshbalyan-1234 's proposal here https://github.com/Expensify/App/issues/28181#issuecomment-1734282062 looks good and works well.

🎀 👀 🎀 C+ Reviewed

melvin-bot[bot] commented 10 months ago

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

abdulrahuman5196 commented 9 months ago

Not overdue melvin. People would be just back from weekend. Anyways Pending review on @luacmartins

saranshbalyan-1234 commented 9 months ago

@abdulrahuman5196 PR is ready to be reviewed. Please check

saranshbalyan-1234 commented 9 months ago

Friendly bump to process payment for this issue

abdulrahuman5196 commented 9 months ago

The PR that introduced the bug has been identified. Link to the PR: 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: 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:

Not a regression. Seems we found this issue now only.

Determine if we should create a regression test for this bug. 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.

Minor bug and wouldn't be beneficial to add regression tests.

abdulrahuman5196 commented 9 months ago

@adelekennedy Seems melvin didn't update this issue properly. Seems the PR went to production 2 weeks back https://github.com/Expensify/App/pull/28739#issuecomment-1750146499

Can we process the payments for this issue?

adelekennedy commented 9 months ago

Thank you for the bump!

Payouts due:

Issue Reporter: $50 @dhanashree-sawant Contributor: $750 @saranshbalyan-1234 Contributor+: $750 @abdulrahuman5196

Eligible for 50% Y

Upwork job is here.

abdulrahuman5196 commented 9 months ago

@adelekennedy Merge time is the one to consider for urgency bonus. This PR was merged in almost a day, so eligible for the bonus.

Applied in upwork.

saranshbalyan-1234 commented 9 months ago

Not able to apply on Upwork, please send an offer

dhanashree-sawant commented 9 months ago

Hi @adelekennedy, on upwork, it says that offer is not available. can you resend it once?

saranshbalyan-1234 commented 9 months ago

Hi @adelekennedy please have a look

adelekennedy commented 9 months ago

reposted the job here

saranshbalyan-1234 commented 9 months ago

accepted

saranshbalyan-1234 commented 9 months ago

@adelekennedy friendly bump for payment

abdulrahuman5196 commented 9 months ago

Accepted invite @adelekennedy

abdulrahuman5196 commented 8 months ago

Gentle ping @adelekennedy

adelekennedy commented 8 months ago

@abdulrahuman5196 On my end Upwork shows this contract as being paid and completed (with the bonus included)

Screenshot 2023-10-30 at 8 55 38 AM
abdulrahuman5196 commented 8 months ago

@adelekennedy Sorry. I was looking at the old upwork contract. Got paid thank you.