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

[HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$1000] Web - When input exceeds 500k characters, the web freezes. #25804

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 23, 2023 · 108 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 23, 2023

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. Go to Create a New Chat, New Group, or New Task.
  2. Input exceeds 500k characters into the search bar or title.

Expected Result:

The website does not crash when entering long text.

Actual Result:

The website is frozen or crash

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.56-21

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

Crash.1.mp4
Crash.2.mp4
Recording.1308.mp4

Expensify/Expensify Issue URL:

Issue reported by: @LeThiThuThuy

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691988614374279

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ffb0be0940793404
  • Upwork Job ID: 1696326036875673600
  • Last Price Increase: 2023-09-19
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 23, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@ahmedGaber93
Copy link
Contributor

ahmedGaber93 commented Aug 23, 2023

Proposal

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

When input exceeds 500k characters, the web freezes.

What is the root cause of that problem?

There is no maxLength prop in OptionsSelector which make TextInput accept infinity length of text

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

To achieve the desired design, we need

  1. in BaseOptionsSelector.js we will set default prop for maxLength equal CONST.SEARCH_MAX_LENGTH (we will create this const = 500 or what we agree on), and we still can control using prop maxLength={100} if needed.

  2. because we allow the user to enter text more than maxLength (101/100), but we don't need to display result for it, we need to save the input value in internal state in BaseOptionsSelector.js to can get its length and stop pass it up by this.props.onChangeText(value) when maxLength reach

updateSearchValue(value){
    if (value.length > this.props.maxLength) {
        this.setState({
            errorMessage: this.props.translate("common.error.characterLimitExceedCounter", {length: value.length, limit: this.props.maxLength}),
            searchValue: value,
        });
        return;
    }

    this.setState({
        errorMessage: "",
        searchValue: value,
    });

    this.props.onChangeText(value);
}
    
<TextInput
    value={this.state.searchValue}
    onChangeText={this.updateSearchValue}
    errorText={this.state.errorMessage}
    maxLength={this.props.maxLength + CONST.ERROR_EXCEED_RANGE}
  1. stop display "no result found" when found error
headerMessage={this.state.errorMessage ? "" : this.props.headerMessage}
Screen.Recording.2023-10-03.at.12.29.53.AM.mov

my branch

What alternative solutions did you explore? (Optional)

N/A

@jeet-dhandha
Copy link
Contributor

Proposal

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

  • Issue is that on pasting longer text in composer, it slows down the browser. As processing longer text takes time, low end devices are affected more.

What is the root cause of that problem?

  • The root cause is that the text is processed in one go. So, the browser is busy processing the text and can't do anything else.

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

  • We can add a limit on paste event. So, if the text is longer than the limit we can show Paste Limit Exceeded error.

  • Another option is to clip the text to the limit and show Paste Limit Exceeded error.

  • Finally remove the Paste Limit Exceeded error after 1.5s.

Screenshot 2023-08-24 at 9 39 10 AM

What alternative solutions did you explore? (Optional)

  • N/A

@melvin-bot melvin-bot bot added the Overdue label Aug 28, 2023
@johncschuster johncschuster added the External Added to denote the issue can be worked on by a contributor label Aug 29, 2023
@melvin-bot melvin-bot bot changed the title Web - When input exceeds 500k characters, the web freezes. [$1000] Web - When input exceeds 500k characters, the web freezes. Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

Current assignee @johncschuster is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@johncschuster
Copy link
Contributor

Not overdue. The issue has just been triaged to External.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Aug 29, 2023
@meldevigolsen
Copy link

Proposal

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

Inputting too many characters in the input for contact search causes the page to crash and require a refresh of the page.

What is the root cause of that problem?

RegExp throws this uncaught error:

image

image

Further debugging shows that the error is thrown from this line:

matching = matchRegex.test(valueToSearch) || (!isChatRoom && participantNames.has(word));

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

Add a string length check in src/libs/OptionsListUtils.js and return a common.characterLimit message if string length exceeds 5000 characters.

characterLimit: ({limit}) => `Exceeds the maximum length of ${limit} characters`,

This will inform the user of the limitations and prevent this from crashing the page. This will also take advantage of preexisting and future translations.

What alternative solutions did you explore? (Optional)

(Blank)

@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2023

📣 @meldevigolsen! 📣
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. 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.
  2. 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.
  3. 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>

@meldevigolsen
Copy link

Contributor details
Your Expensify account email: meldevigolsen@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01812d3213d2b1075f

@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 1, 2023

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

@allroundexperts
Copy link
Contributor

@jeet-dhandha I don't think that your proposal is tackling the correct problem here.

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2023
@allroundexperts
Copy link
Contributor

@shawnborton I would like to confirm what the expected behaviour should be design wise. Should we display an error if the input length exceeds the allowed length or just not let the user enter anything more in the input without showing them any error?

On a side note, this error exists in all of the OptionSelector fields. We should aim to fix this in all such fields.

@jeet-dhandha
Copy link
Contributor

I know my proposal isn't directly solving the issue. As main issue is the freezing of web which is mostly due to pre-processing of emojis.

@allroundexperts
Copy link
Contributor

That's not right. The issue is for option selector inputs instead of the composer.

@shawnborton
Copy link
Contributor

Should we display an error if the input length exceeds the allowed length or just not let the user enter anything more in the input without showing them any error?

I don't feel strongly here. This feels like such an edge case that a user would actually type 500 characters into a text input that I am not too worried about needing an explicit error message, I think even just preventing any more characters would be fine. Curious what @dannymcclain @JmillsExpensify and @trjExpensify think though.

In terms of the option selector, can you show me what you mean by that?

@trjExpensify
Copy link
Contributor

500k characters? As in, 500,000? Haha, wild. We have this issue to reduce the character limits to something more reasonable across the board.

Interestingly, @joekaufmanexpensify and I stumbled upon this same topic last week in an issue and I believe he was bringing it out to Slack. I think we should follow the form pattern here really to show an in-line error on blur. Additionally, Joe had the idea to then show a character limit counter if it has been exceeded, so you know how many you need to delete to get back under the allowed limit.

I think that's a good approach personally. Different fields have different lengths, so an error message to highlight what it is, is more helpful than preventing further typing or auto-truncating if you paste more characters than allowed.

@thuyle04
Copy link

Contributor details
Your Expensify account email: thuy.lethithu@antbuddy.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01fcd9ed589276332f

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

@thuyle04
Copy link

Contributor details
Your Expensify account email: thuy.lethithu@antbuddy.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01fcd9ed589276332f

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

@flodnv, @johncschuster, @allroundexperts, @ahmedGaber93 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@JmillsExpensify
Copy link

Need a payment summary for this issue.

@johncschuster
Copy link
Contributor

Payment Summary

@allroundexperts does not require payment (Eligible for Manual Requests) - $1000 - paid via NewDot
@ahmedGaber93 requires payment -$1000 - paid via Upwork
@LeThiThuThuy requires payment - $250 (previous Bug Reporter payment amount) - paid via Upwork

@melvin-bot melvin-bot bot removed the Overdue label Oct 24, 2023
@JmillsExpensify
Copy link

$1,000 payment approved for @allroundexperts based on summary above.

@johncschuster
Copy link
Contributor

@allroundexperts for the regression test, I think this is a typo:

Paste text that exceeds 500k characters into the search bar

That's just meant to be "exceeds 500 characters", right?

@allroundexperts
Copy link
Contributor

@johncschuster Yes 🙈

@thuyle04
Copy link

Contributor details
Your Expensify account email: thuy.lethithu@antbuddy.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01fcd9ed589276332f

@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

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

@johncschuster
Copy link
Contributor

Looks like the job closed on Upwork. I'll create a payment issue and add @ahmedGaber93 and @LeThiThuThuy to that.

@johncschuster
Copy link
Contributor

Ah, it looks like @LeThiThuThuy has been updated to @thuyle04. I will add them to the payment issue.

@johncschuster
Copy link
Contributor

@ahmedGaber93, please comment on the above GH so I can assign it to you for payment. Thank you!

@ahmedGaber93
Copy link
Contributor

ahmedGaber93 commented Oct 25, 2023

@johncschuster Ok, commented.

@thuyle04
Copy link

Contributor details
Your Expensify account email: thuy.lethithu@antbuddy.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01fcd9ed589276332f

@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

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

@johncschuster
Copy link
Contributor

@ahmedGaber93 I don't see your comment on #30399. Can you please try again? Once you've commented, I can assign it and you'll be invited to the job.

@ahmedGaber93
Copy link
Contributor

Ok, commented recheck @johncschuster

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@flodnv, @johncschuster, @allroundexperts, @ahmedGaber93 Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Nov 1, 2023

@flodnv, @johncschuster, @allroundexperts, @ahmedGaber93 Eep! 4 days overdue now. Issues have feelings too...

@johncschuster
Copy link
Contributor

Payment is being issued here. I'm going to close this issue.

@melvin-bot melvin-bot bot removed the Overdue label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests