Skip to content

[HOLD for payment 2023-10-16] Chat - Expand button disappear after clicking even when composer has error #27779

Closed

Description

@kbecciv

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

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 19, 2023
  2. DylanDylann commented on Sep 19, 2023

    @DylanDylann
    Contributor

    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
  3. changed the title [-]Chat - Clicking on Send button make the error disappear[/-] [+][$500] Chat - Clicking on Send button make the error disappear[/+] on Sep 19, 2023
  4. melvin-bot commented on Sep 19, 2023

    @melvin-bot
  5. melvin-bot commented on Sep 19, 2023

    @melvin-bot

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

  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 19, 2023
  7. melvin-bot commented on Sep 19, 2023

    @melvin-bot

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

    @melvin-bot

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

  9. melvin-bot commented on Sep 19, 2023

    @melvin-bot

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

  10. kbecciv commented on Sep 19, 2023

    @kbecciv
    Author

    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

  11. 36 remaining items

  12. melvin-bot commented on Oct 9, 2023

    @melvin-bot

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

  13. melvin-bot commented on Oct 9, 2023

    @melvin-bot

    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
  14. melvin-bot commented on Oct 9, 2023

    @melvin-bot

    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:
  15. robertKozik commented on Oct 10, 2023

    @robertKozik
    Contributor

    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:

  16. DylanDylann commented on Oct 12, 2023

    @DylanDylann
    Contributor

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

  17. jliexpensify commented on Oct 18, 2023

    @jliexpensify
    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!

  18. jliexpensify commented on Oct 18, 2023

    @jliexpensify
    Contributor

    Payment Summary:

    Upwork job

  19. DylanDylann commented on Oct 18, 2023

    @DylanDylann
    Contributor

    Yeah thanks @jliexpensify

  20. jliexpensify commented on Oct 18, 2023

    @jliexpensify
    Contributor

    All paid and job closed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions