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-16] Chat - Expand button disappear after clicking even when composer has error #27779

Closed
2 of 6 tasks
kbecciv opened this issue Sep 19, 2023 · 34 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 External Added to denote the issue can be worked on by a contributor

Comments

@kbecciv
Copy link

kbecciv commented Sep 19, 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 any report
  2. Paste the message that has over 15,000 characters (To make the error shows).
  3. Now the composer will have red border and expand button is visible, click on the Send button.
  4. Notice that now the Composer doesn’t have Expand button.

Expected Result:

Expand button should be visible after clicking Send button

Actual Result:

Expand button disappear after clicking even when composer has error

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: 1.3.71.5
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

RPReplay_Final1695080016.MP4
RPReplay_Final1695128411.MP4

Expensify/Expensify Issue URL:
Issue reported by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694937956481939
https://expensify.slack.com/archives/C049HHMV9SM/p1695124790291359

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01e5b7548a5c671a9e
  • Upwork Job ID: 1704120906245259264
  • Last Price Increase: 2023-09-19
  • Automatic offers:
    • DylanDylann | Contributor | 26978024
    • hungvu193 | Reporter | 26978028
@kbecciv kbecciv added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 19, 2023
@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 19, 2023

Proposal

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

  • Composer: The expand button disappears after you click on the send button

What is the root cause of that problem?

  • Currently, clicking on the send button will call the resetFullComposerSize - which will set the isFullComposerAvailable state to false regardless the isSendDisabled is true or not. That leads to the bug: When the composer has > 15.000 characters, clicking on <SendButton /> will make the expand button disappear. This is the RCA that directly lead to this bug.
  • But the general RCA that leads to this bug or the other like Composer: Clicking on Send button right after clearing input makes the error does not disappear is that: Clicking SendButton or Pressing ENTER button when the isSendDisable is false still triggers a few functions: For example:
    const Tap = Gesture.Tap()
    .enabled()
    .onEnd(() => {
    'worklet';
    const viewTag = animatedRef();
    const viewName = 'RCTMultilineTextInputView';
    const updates = {text: ''};
    // We are setting the isCommentEmpty flag to true so the status of it will be in sync of the native text input state
    runOnJS(setIsCommentEmpty)(true);
    runOnJS(resetFullComposerSize)();
    updatePropsPaperWorklet(viewTag, viewName, updates); // clears native text input on the UI thread
    runOnJS(submitForm)();
    });
  • In above, clicking on <SendButton /> not only trigger submitForm, but also setIsCommentEmpty, resetFullComposerSize and updatePropsPaperWorklet

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

  • The action pressing on ENTER key or clicking on SendButton has the same role when typing a message but in our app, we handle these two actions separately
  • Here is what we do when clicking on SendButton:
    const Tap = Gesture.Tap()
    .enabled()
    .onEnd(() => {
    'worklet';
    const viewTag = animatedRef();
    const viewName = 'RCTMultilineTextInputView';
    const updates = {text: ''};
    // We are setting the isCommentEmpty flag to true so the status of it will be in sync of the native text input state
    runOnJS(setIsCommentEmpty)(true);
    runOnJS(resetFullComposerSize)();
    updatePropsPaperWorklet(viewTag, viewName, updates); // clears native text input on the UI thread
    runOnJS(submitForm)();
    });
  • Here is what we do when pressing on ENTER key:
    // Submit the form when Enter is pressed
    if (e.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey && !e.shiftKey) {
    e.preventDefault();
    submitForm();
    }
  • So we should create a function that handles both clicking send button and pressing ENTER, like below:
 const handleClickingOnSendOrPressingEnter = (isSendDisable) => {
                if (isSendDisable) {
                    return;
                } else {
                    'worklet';

                    const viewTag = animatedRef();
                    const viewName = 'RCTMultilineTextInputView';
                    const updates = {text: ''};
                    // We are setting the isCommentEmpty flag to true so the status of it will be in sync of the native text input state
                    runOnJS(setIsCommentEmpty)(true);
                    runOnJS(resetFullComposerSize)();
                    updatePropsPaperWorklet(viewTag, viewName, updates); // clears native text input on the UI thread
                    runOnJS(submitForm)();
                }
            };
  • If isSendDisable is true, stop the function so that the bug is fixed and the logic when clicking SendButton or pressing ENTER is clearer

If you could update your proposal so that send button won't be disabled during chat loading, but be disabled only after clicking on it

  • We can do that by updating
    {isReportReadyForDisplay && (
    <>
    <ReportFooter
    pendingAction={addWorkspaceRoomOrChatPendingAction}
    isOffline={isOffline}
    reportActions={reportActions}
    report={report}
    isComposerFullSize={isComposerFullSize}
    onSubmitComment={onSubmitComment}
    policies={policies}
    />
    </>
    )}
    {!isReportReadyForDisplay && (
    <ReportFooter
    shouldDisableCompose
    isOffline={isOffline}
    />
    )}
    to
<ReportFooter {... currentProps} isReportReadyForDisplay={isReportReadyForDisplay} />
  • Then update the handleClickingOnSendOrPressingEnter in my proposal to:
const handleClickingOnSendOrPressingEnter = (isSendDisable, isReportReadyForDisplay) => {
                if (isSendDisable || !isReportReadyForDisplay) {
                    return;
                } else {
                   // Hanle submit and clean up logic
                }
            };
  • The above solution will make sure the Send button won`t be disabled during the chat loading, it still displays as clickable, the composer border still displays with a green border, but clicking on send button will not trigger the submit and clean up logic

What alternative solutions did you explore? (Optional)

  • NA

@melvin-bot melvin-bot bot changed the title Chat - Clicking on Send button make the error disappear [$500] Chat - Clicking on Send button make the error disappear Sep 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

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

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

melvin-bot bot commented Sep 19, 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 Sep 19, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 19, 2023

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

@kbecciv
Copy link
Author

kbecciv commented Sep 19, 2023

Proposal by: @hungvu193
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1694937956481939

Proposal

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

Composer: Clicking on Send button make the error disappear while actually it should do nothing.

What is the root cause of that problem?

We're setting disable style for our Pressable inside SendButton here.

<GestureDetector gesture={Tap}>
<Tooltip text={translate('common.send')}>
<PressableWithFeedback
style={({pressed, isDisabled}) => [
styles.chatItemSubmitButton,
isDisabledProp || pressed || isDisabled ? undefined : styles.buttonSuccess,
isDisabledProp ? styles.cursorDisabled : undefined,
]}

However, we're using GestureDetector's gesture to handle the click on Send button, so even the send button is disabled, it still perform the gesture and in our Tap gesture which caused this issue:
const Tap = Gesture.Tap()
.enabled()
.onEnd(() => {
'worklet';
const viewTag = animatedRef();
const viewName = 'RCTMultilineTextInputView';
const updates = {text: ''};
// We are setting the isCommentEmpty flag to true so the status of it will be in sync of the native text input state
runOnJS(setIsCommentEmpty)(true);
runOnJS(resetFullComposerSize)();
updatePropsPaperWorklet(viewTag, viewName, updates); // clears native text input on the UI thread
runOnJS(submitForm)();
});

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

Solution 1:
We should disable the Tap gesture if isDisabledProp is true:

const Tap = Gesture.Tap()
        .enabled(!isDisabledProp)
        .onEnd(() => {

Solution 2:
Add an early return when isDisabledProp is true inside onEnd function:

 .onEnd(() => {
            'worklet';
             if (isDisabledProp) {
                 return;
             }

What alternative solutions did you explore? (Optional)

N/A

@kbecciv kbecciv changed the title [$500] Chat - Clicking on Send button make the error disappear Chat - Expand button disappear after clicking even when composer has error Sep 19, 2023
@akinwale
Copy link
Contributor

akinwale commented Sep 19, 2023

This has the same root cause as #26960 where if the send button is set to disabled, the tap action still gets executed.

Pointed out here, and a working proposal for the fix.

@jliexpensify
Copy link
Contributor

@robertKozik based on the comment above, this sounds like it could be a dupe? Shall we close this or maybe put this on hold?

@DylanDylann
Copy link
Contributor

@jliexpensify I think App allows to write and send message in skeleton view is expected behavious

@robertKozik
Copy link
Contributor

No, it's not a duplicate. The issue that @akinwale linked did contain a proposal with a solution that would also fix our issue. However, that issue as a whole was closed because it pertained to expected behavior. I'll review the proposals today.

@melvin-bot melvin-bot bot added the Overdue label Sep 22, 2023
@jliexpensify
Copy link
Contributor

Any thoughts on the proposals @robertKozik ?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 26, 2023

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

@robertKozik
Copy link
Contributor

Hi @DylanDylann @hungvu193! Both of you siggested simillar solution for this problem, which potencially suffers from the same problem. Per #26960 issue we want the send button to be accessible when chat is loading.
@hungvu193 your solution is passing the isDisabledProp which would disable the send button while loading
@DylanDylann is the isSendDisabled variable identical with isDisabledProp? If yes, it will case the same problem.

If you could update your proposal so that send button won't be disabled during chat loading, but be disabled only after clicking on it

@melvin-bot melvin-bot bot removed the Overdue label Sep 26, 2023
@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 26, 2023

@robertKozik Also please note that my proposal will fix the case pressing the ENTER button, not only clicking on "Send" button. Because pressing the ENTER button or clicking on the Send button should be the same, right?

@DylanDylann
Copy link
Contributor

DylanDylann commented Sep 26, 2023

@robertKozik

If you could update your proposal so that send button won't be disabled during chat loading, but be disabled only after clicking on it

  • You mean that the send button can be clicked on (displayed as the green button) but no action is triggered, right? We can do that by updating
    {isReportReadyForDisplay && (
    <>
    <ReportFooter
    pendingAction={addWorkspaceRoomOrChatPendingAction}
    isOffline={isOffline}
    reportActions={reportActions}
    report={report}
    isComposerFullSize={isComposerFullSize}
    onSubmitComment={onSubmitComment}
    policies={policies}
    />
    </>
    )}
    {!isReportReadyForDisplay && (
    <ReportFooter
    shouldDisableCompose
    isOffline={isOffline}
    />
    )}
    to
<ReportFooter {... currentProps} isReportReadyForDisplay={isReportReadyForDisplay} />
  • Then update the handleClickingOnSendOrPressingEnter in my proposal to:
const handleClickingOnSendOrPressingEnter = (isSendDisable, isReportReadyForDisplay) => {
                if (isSendDisable || !isReportReadyForDisplay) {
                    return;
                } else {
                   // Hanle submit and clean up logic
                }
            };
  • The above solution will make sure the Send button won`t be disabled during the chat loading, it still displays as clickable, the composer border still displays with a green border, but clicking on send button will not trigger the submit and clean up logic

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

melvin-bot bot commented Oct 2, 2023

📣 @DylanDylann 🎉 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 📖

@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

📣 @hungvu193 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 3, 2023
@DylanDylann
Copy link
Contributor

@robertKozik PR #28681 is ready for review

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @DylanDylann got assigned: 2023-10-02 11:45:06 Z
  • when the PR got merged: 2023-10-06 08:43:22 UTC
  • days elapsed: 3

On to the next one 🚀

@jliexpensify
Copy link
Contributor

Should @DylanDylann be paid a reporting bonus here? It looks like there was a ~3 day delay for @robertKozik to review the PR cc @aldo-expensify for your thoughts

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 9, 2023
@melvin-bot melvin-bot bot changed the title Chat - Expand button disappear after clicking even when composer has error [HOLD for payment 2023-10-16] Chat - Expand button disappear after clicking even when composer has error Oct 9, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.79-5 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-10-16. 🎊

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

For reference, here are some details about the assignees on this issue:

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 Oct 9, 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:

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

@robertKozik
Copy link
Contributor

robertKozik commented Oct 10, 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:

  • [@robertKozik] The PR that introduced the bug has been identified. Link to the PR: Performance: chat input #25758
  • [@robertKozik] 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: https://github.com/Expensify/App/pull/25758/files#r1351875313
  • [@robertKozik] 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: N/A
  • [@robertKozik] Determine if we should create a regression test for this bug. I don't think we need new test here
  • [@robertKozik] 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. N/A

@DylanDylann
Copy link
Contributor

@aldo-expensify Please help check #27779 (comment) when you have a chance

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 Daily KSv2 labels Oct 16, 2023
@jliexpensify
Copy link
Contributor

Hi @DylanDylann - I actually queried this with another GH (same situation, delay in C+) and was told that bonuses only apply if the Expensify Engineer is delayed. Sorry!

@jliexpensify
Copy link
Contributor

Payment Summary:

Upwork job

@DylanDylann
Copy link
Contributor

Yeah thanks @jliexpensify

@jliexpensify
Copy link
Contributor

All paid and job closed!

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