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-05-25] [$1000] Input field flickers on sending long messages. #18238

Closed
1 of 6 tasks
kavimuru opened this issue May 1, 2023 · 26 comments
Closed
1 of 6 tasks
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented May 1, 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. Open the App.
  2. Open any chat.
  3. Type long message.

Expected Result

Input field (observe green border) should not flicker on sending long messages.

Actual Result

Input field (observe green border) flickers on sending long messages.

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?

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

Version Number: 1.3.8.8
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

Bug.mp4
az_recorder_20230501_134954.1.mp4

Expensify/Expensify Issue URL:
Issue reported by: @usmantariq96
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1682944586188219

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016ac49814e372be6c
  • Upwork Job ID: 1655664631580786688
  • Last Price Increase: 2023-05-08
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 1, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented May 1, 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

@melvin-bot melvin-bot bot added the Overdue label May 3, 2023
@MelvinBot
Copy link

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

@michaelhaxhiu
Copy link
Contributor

Replicated on my android testing device. I'm pushing to external and re-assigning because I'll be OOO this week.

@melvin-bot melvin-bot bot removed the Overdue label May 8, 2023
@michaelhaxhiu michaelhaxhiu added External Added to denote the issue can be worked on by a contributor Overdue labels May 8, 2023
@michaelhaxhiu michaelhaxhiu removed their assignment May 8, 2023
@melvin-bot melvin-bot bot removed the Overdue label May 8, 2023
@michaelhaxhiu michaelhaxhiu removed the Bug Something is broken. Auto assigns a BugZero manager. label May 8, 2023
@melvin-bot melvin-bot bot changed the title Input field flickiers on sending long messages. [$1000] Input field flickiers on sending long messages. May 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@michaelhaxhiu michaelhaxhiu added the Bug Something is broken. Auto assigns a BugZero manager. label May 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 8, 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

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

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

melvin-bot bot commented May 8, 2023

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

@michaelhaxhiu
Copy link
Contributor

@Christinadobrzyn I didn't check the final box because I think it's ideal for the next BZ to do so!

I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@bernhardoj
Copy link
Contributor

bernhardoj commented May 9, 2023

Proposal

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

Composer height is flickering when sending multiline message, only on Android.

What is the root cause of that problem?

If we look carefully at the video, we can see that the composer is expanding for a glimpse even though the composer is empty and then back to the normal height. The height expand because the Expand button (the arrow icon) is showing.
image

The expand icon will show if isFullComposerAvailable state is true and composer is currently not in full size and the cause of this issue is when we send the message, we set isFullComposerAvailable to false, but then it switch to true for a while before going back to false again. isFullComposerAvailable state depends on the content size height of the composer/input. Here is how it works:

  1. When the content size changes, we call updateNumberOfLines to calculate the number of lines from the content height (not the composer height).

    onContentSizeChange={e => ComposerUtils.updateNumberOfLines(this.props, e)}

  2. After we get the number of lines, we update isFullComposerAvailable to true if the number of lines is >= 3.

    function updateNumberOfLines(props, e) {
    const lineHeight = styles.textInputCompose.lineHeight;
    const paddingTopAndBottom = styles.textInputComposeSpacing.paddingVertical * 2;
    const inputHeight = lodashGet(e, 'nativeEvent.contentSize.height', null);
    if (!inputHeight) {
    return;
    }
    const numberOfLines = getNumberOfLines(lineHeight, paddingTopAndBottom, inputHeight);
    updateIsFullComposerAvailable(props, numberOfLines);
    }

    function updateIsFullComposerAvailable(props, numberOfLines) {
    const isFullComposerAvailable = numberOfLines >= CONST.COMPOSER.FULL_COMPOSER_MIN_LINES;
    if (isFullComposerAvailable !== props.isFullComposerAvailable) {
    props.setIsFullComposerAvailable(isFullComposerAvailable);
    }
    }

In conclusion, when the number of lines is >= 3, we will show the expand button. However, from the video we can see that after we send the message, we still show the expand button even though the number of lines should be 1 because the input is now empty. After doing some testing, I found that this is a bug of Android when we set max height to a TextInput. To reproduce the bug, we need to type multiline text until it's overflow (more lines than the max height), in this case I think 6/7 lines are enough. When we clear the input (programmatically), it will trigger onContentSizeChange twice. First with the height of the composer/input when we are at maximum height (from my log, I got 124.xx), while the second one will correctly give the content size.

So, when we send the message, here is what happens:

  1. Set isFullComposerAvailable to false
    this.updateComment('');
    this.setTextInputShouldClear(true);
    if (this.props.isComposerFullSize) {
    Report.setIsComposerFullSize(this.props.reportID, false);
    }
    this.setState({isFullComposerAvailable: false});
  2. onContentSizeChange first trigger with the height of composer (124.xx). From this height, we get 6 number of lines which is >= 3. So, we set isFullComposerAvailable to true.
  3. onContentSizeChange second trigger with the correct content size (17.xx). From this height, we get 1 number of line which is < 3. So, we set isFullComposerAvailable to false.

This make the composer flickers. This issue also maybe related to the open issue here which has been open for > 2 years.

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

We can add another condition to check if the composer full size is available by checking if the content of the text is not empty. Example:

const isFullComposerAvailable = this.state.isFullComposerAvailable && !_.isEmpty(this.state.value);

This way, we will only set isFullComposerAvailable to true if the composer is not empty. Then we replace all usage of this.state.isFullComposerAvailable inside render with isFullComposerAvailable.

Result

Screen.Recording.2023-05-11.at.21.33.47.mov

@melvin-bot melvin-bot bot added the Overdue label May 10, 2023
@mollfpr
Copy link
Contributor

mollfpr commented May 11, 2023

@bernhardoj Thanks for the proposal. You've the right root cause, but could you attach a video result regarding your proposal?

@melvin-bot melvin-bot bot removed the Overdue label May 11, 2023
@bernhardoj
Copy link
Contributor

@mollfpr Added the video result

@mollfpr
Copy link
Contributor

mollfpr commented May 12, 2023

Thanks, @bernhardoj! I have tested your solution and it seems that the expandable button is still displayed after the input is cleared, and it makes the composer not resize properly. Your solution is reasonable and it fixes the issue.

@yuwenmemon We can go with @bernhardoj's proposal!

🎀 👀 🎀 C+ reviewed!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 12, 2023

📣 @bernhardoj You have been assigned to this job by @yuwenmemon!
Please apply to this job in Upwork 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 📖

@bernhardoj
Copy link
Contributor

PR is ready

@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

🎯 ⚡️ Woah @mollfpr / @bernhardoj, great job pushing this forwards! ⚡️

The pull request got merged within 2 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @bernhardoj got assigned: 2023-05-12 18:33:28 Z
  • when the PR got merged: 2023-05-15 16:56:50 UTC

On to the next one 🚀

@Christinadobrzyn Christinadobrzyn changed the title [$1000] Input field flickiers on sending long messages. [$1000] Input field flickers on sending long messages. May 15, 2023
@Christinadobrzyn
Copy link
Contributor

Hired in Upwork - job posting - https://www.upwork.com/jobs/~016ac49814e372be6c

@usmantariq96
Copy link

@Christinadobrzyn Applied
Thanks

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 18, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Input field flickers on sending long messages. [HOLD for payment 2023-05-25] [$1000] Input field flickers on sending long messages. May 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.15-12 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-05-25. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented May 18, 2023

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:

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] 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:
  • [@mollfpr] 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:
  • [@mollfpr] Determine if we should create a regression test for this bug.
  • [@mollfpr] 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.
  • [@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon: https://github.com/Expensify/Expensify/issues/286513

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 24, 2023
@Christinadobrzyn
Copy link
Contributor

Hey @mollfpr What are you thinking for a regression test? I'm not 100% if we need one, what do you think?

@mollfpr
Copy link
Contributor

mollfpr commented May 25, 2023

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

No offending PR. This was caused by a lingering issue from RN where onContentSizeChange is incorrectly calculated.

[@mollfpr] 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:

https://expensify.slack.com/archives/C049HHMV9SM/p1684990508491559

[@mollfpr] Determine if we should create a regression test for this bug.

It's not a pretty bug, so, yes, please!

[@mollfpr] 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.

Propose regression step

  1. Open any chat
  2. Type multiple lines of message in the composer until it can be scrolled
  3. Send the message
  4. Verify the composer does not flicker (does not expanding and collapsing multiple times)
  5. 👍 or 👎

@Christinadobrzyn
Copy link
Contributor

Thanks @mollfpr!

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 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants