Android - Chat - Composer reduced with delay after sending message with several line breaks
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.56-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5171395&group_by=cases:section_id&group_order=asc&group_id=292106 Issue reported by: Applause - Internal Team
Action Performed:
- Open the Expensify app
- Open any chat
- Write a message with at least ten line breaks
- Send the message to chat
- Verify that compose box is automatically reduced after sending the message
Expected Result:
Compose box should be automatically reduced after sending message with several line breaks
Actual Result:
After sending a message with ten or more line breaks, compose box is reduced with delay. It can be seen expanded without any message inside for a second
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- [ ] Android: Standalone
- [x] Android: HybridApp
- [ ] Android: mWeb Chrome
- [ ] iOS: Standalone
- [ ] iOS: HybridApp
- [ ] iOS: mWeb Safari
- [ ] MacOS: Chrome / Safari
- [ ] MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/user-attachments/assets/5a5899e2-d615-4e0a-a884-db59a381ad79
Triggered auto assignment to @bfitzexpensify (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.
@bfitzexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Proposal
Please re-state the problem that we are trying to solve in this issue.
The composer height shrinks to its normal size with a delay after sending a long message.
What is the root cause of that problem?
We can notice two steps after sending a message: 1) the composer is cleared. 2) the expand button is removed. Between 1 and 2, there is an intermediate state that the composer is empty, but the expand button is still visible.
Some processes take place during this period, including 1) layout recalculation, 2) TextInput detecting layout changes and emitting the onContentSizeChange event, 3) the composer receiving the onContentSizeChange event,
https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/components/Composer/implementation/index.native.tsx#L121
4) setting isFullComposerAvailable to false,
https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/libs/ComposerUtils/updateIsFullComposerAvailable.ts#L19
and 5) removing the expand button.
https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx#L271-L272
What changes do you think we should make in order to solve the problem?
Directly set isFullComposerAvailable to false after the composer is cleared by adding setIsFullComposerAvailable(false) in the composer’s onClear event handler.
https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/components/Composer/implementation/index.native.tsx#L85
What alternative solutions did you explore? (Optional)
N/A
@bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Job added to Upwork: https://www.upwork.com/jobs/~021853878523826471511
Triggered auto assignment to Contributor-plus team member for initial proposal review - @hoangzinh (External)
Hi @QichenZhu can you help me understand why in case we select all text and clear, it works properly but tapping on Send button? Thank you
https://github.com/user-attachments/assets/18aa80dc-fd90-424b-8c04-de4c6e50e38b
@hoangzinh
Hi @QichenZhu can you help me understand why in case we select all text and clear, it works properly but tapping on Send button?
Normal edit triggers onChangeText event, while clicking the send button dispatches the clear command to the native side and triggers the onClear event.
In both cases, the composer only shrinks after updateComment is called. Wrapping this line and this line with setTimeout makes it more obvious, as shown in the videos below.
// onChangeText
setTimeout(() => updateComment(commentValue, true), 1000);
// onClear
setTimeout(() => updateComment('', true), 1000);
https://github.com/user-attachments/assets/e24b3b56-8fa3-4a0b-8b3b-25eba234e3bd
https://github.com/user-attachments/assets/1c4e46d5-8485-4b55-b4b4-a998a7a5f861
The difference is that in the first video, the expand button is removed before the composer shrinks, while in the second video, the expand button is removed after the composer shrinks. The cause of the difference is not quite clear. I don’t think the order matters technically as long as the final state is the same, but from a user’s perspective, the former looks better.
Thanks @QichenZhu. His proposal looks good to me
Link to proposal https://github.com/Expensify/App/issues/51875#issuecomment-2452890796
🎀👀🎀 C+ reviewed
Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
📣 @QichenZhu 🎉 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 📖
Reviewing label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.63-3 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/52300
If no regressions arise, payment will be issued on 2024-11-26. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @hoangzinh requires payment through NewDot Manual Requests
- @QichenZhu requires payment automatic offer (Contributor)
@hoangzinh @bfitzexpensify @hoangzinh The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Payment complete to @QichenZhu - @hoangzinh, please complete the BZ checklist and I'll post the C+ ND payment summary
BugZero Checklist:
- [x] [Contributor] Classify the bug:
Bug classification
Source of bug:
- [ ] 1a. Result of the original design (eg. a case wasn't considered)
- [ ] 1b. Mistake during implementation
- [ ] 1c. Backend bug
- [x] 1z. Other: The logic in the composer becomes bigger day by day. Therefore, previous implementation doesn't work anymore.
Where bug was reported:
- [ ] 2a. Reported on production
- [ ] 2b. Reported on staging (deploy blocker)
- [x] 2c. Reported on both staging and production
- [ ] 2d. Reported on a PR
- [ ] 2z. Other:
Who reported the bug:
- [ ] 3a. Expensify user
- [ ] 3b. Expensify employee
- [ ] 3c. Contributor
- [x] 3d. QA
- [ ] 3z. Other:
-
[x] [Contributor] 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: There is no direct offending PR that caused this bug. It seems the previous implementation was not good enough for today. We refactored it in this issue.
-
[x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A
-
[x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again. No. It's just a small UI issue on Android devices.
Payment summary:
@hoangzinh to be paid $250 for C+ work.
$250 approved for @hoangzinh