Skip to content

"User is typing..." will appear briefly when the other user leaves and returns to the chat. #25551

Closed

Description

@kavimuru

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. Login with 2 users ( User A and User B ) in front of you at the same time.
  2. Open the chat room between the two users.
  3. As User A start Typing in the composer > then leave the room ( with text in the composer ) to any other room > Then return to the room again.
  4. Now notice User B.

Expected Result:

"User A is typing..." shouldn't appear for user B. Because User A isn't actually Typing, He just left the chat and then returned.

Actual Result:

When User A leaves and returns to the chat, "User A is typing..." briefly appears for User B.

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.55-2
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

VIDEO.mov
Recording.5943.1.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Ahmed-Abdella
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691625061000749

View all open jobs on GitHub

Activity

  1. dukenv0307 commented on Aug 20, 2023

    @dukenv0307
    Contributor

    Proposal

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

    "User is typing..." will appear briefly when the other user leaves and returns to the chat.

    What is the root cause of that problem?

    When we return the chat, componentDidMount of ReportActionCompose is triggered and in this function, we call updateComment function.

    updateComment(comment, shouldDebounceSaveComment) {

    In updateComment, we always display "user typing ..." if newComment is not empty. Because the draft message is not empty, when we return the chat, "user typing ..." appear briefly.

    if (newComment) {
    this.debouncedBroadcastUserIsTyping();
    }

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

    We should check if the current value state and newComment is equal which means this is the draft message, we will not display user is typing

    newComment && newComment !== this.state.value
    

    if (newComment) {
    this.debouncedBroadcastUserIsTyping();
    }

    What alternative solutions did you explore? (Optional)

    NA

    Result

    Screencast.from.10-08-2023.10.45.09.webm
  2. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 20, 2023
  3. melvin-bot commented on Aug 20, 2023

    @melvin-bot

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

  4. melvin-bot commented on Aug 20, 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
  5. jfquevedol2198 commented on Aug 20, 2023

    @jfquevedol2198
    Contributor

    This was proposed on 11 days ago on Slack channel

    Proposal

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

    “User is typing...” will appear briefly when the other user leaves and returns to the chat.

    What is the root cause of that problem?

    if (newComment) {
    this.debouncedBroadcastUserIsTyping();
    }

    When return to the room that has draft message, ReportActionCompose component’s updateComment method is not checking whether its new message or from draft message.

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

    Update this line like following:

        if (newComment && this.state.value !== comment) {
          this.debouncedBroadcastUserIsTyping();
        }

    What alternative solutions did you explore? (Optional)

    N/A

  6. Ahmed-Abdella commented on Aug 21, 2023

    @Ahmed-Abdella
    Contributor

    @kavimuru hey kavi, you uploaded the wrong video, the first video in the issue is not the bug video. This is the video

  7. DylanDylann commented on Aug 21, 2023

    @DylanDylann
    Contributor

    Proposal

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

    “User is typing...” will appear briefly when the other user leaves and returns to the chat.

    What is the root cause of that problem?

    When user leaves and comebacks to the chat, the below line will pass the condition if !!newComment is true so it always call "debouncedBroadcastUserIsTyping" function

    if (newComment) {
    this.debouncedBroadcastUserIsTyping();
    }

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

    1. Update function
      updateComment(comment, shouldDebounceSaveComment) {
      like bellow:
    updateComment(comment, shouldDebounceSaveComment, shouldBroadcastUserIsTyping = true) {
           ...
            if (newComment && shouldBroadcastUserIsTyping) {
                this.debouncedBroadcastUserIsTyping();
            }
        }
    
    1. And when the ReportActionCompose didMount, we should call like
      this.updateComment(this.comment, false, false);
    

    rather than

    this.updateComment(this.comment);

    What alternative solutions did you explore? (Optional)

    N/A

    Result

    Screencast.from.18-08-2023.16.03.34.webm
  8. bernhardoj commented on Aug 21, 2023

    @bernhardoj
    Contributor

    Proposal

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

    Revisit a chat with a draft will broadcast "user typing" to the user.

    What is the root cause of that problem?

    When the component is mounted, we will call updateComment, and inside updateComment, we will broadcast the "user typing" if the comment/text is not empty.

    if (newComment) {
    debouncedBroadcastUserIsTyping(reportID);
    }

    This logic (calling updateComment on mount) is introduced in this PR to set the initial isCommentEmpty state correctly.
    image

    Currently, the initial value of isCommentEmpty taking spaces into account ( is considered not empty),

    const [isCommentEmpty, setIsCommentEmpty] = useState(comment.length === 0);

    but updateComment will set isCommentEmpty to true only if the value contains at least one non-space character ( is considered empty).

    setIsCommentEmpty(!!newComment.match(/^(\s)*$/));

    Because of this difference, we call updateComment on composer mount.

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

    updateComment do other things besides updating isCommentEmpty so we shouldn't use it to update isCommentEmpty correctly. I see this as a workaround. Instead, we should correctly initialize isCommentEmpty by using the same condition.

    update

    const [isCommentEmpty, setIsCommentEmpty] = useState(comment.length === 0);

    to !!comment.match(/^(\s)*$/) (we can create a new function to contain this logic/condition)

  9. joekaufmanexpensify commented on Aug 21, 2023

    @joekaufmanexpensify
    Contributor

    I can reproduce this, but not sure whether this really qualifies as a "bug". Going to bring up in Slack for discussion!

  10. joekaufmanexpensify commented on Aug 21, 2023

    @joekaufmanexpensify
    Contributor
  11. joekaufmanexpensify commented on Aug 22, 2023

    @joekaufmanexpensify
    Contributor

    Discussed in the above thread and decided this isn't really a bug. Closing as no action is needed!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions