question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Draft message feature not working correctly

See original GitHub issue

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Expected Result:

Drafted message text should constrained to the user selected when the text was entered into the compose box, draft icon should show only when text exists in the compose box.

Actual Result:

After drafting message text in the compose box for (but prior to sending), text continues to show after clicking into another chat, draft icon continues to show when text does not exist in the compose box.

Action Performed:

Issue 1:

After drafting message text in the compose box for (but prior to sending), text continues to show after clicking into another chat (2 users)

  1. Open a chat with User A
  2. Enter text into the compose box (but do not send)
  3. Switch to chat with User B
  4. Notice: Message drafted in compose box to User A continues to show in compose box in chat with User B

Issue 2:

After drafting message text in the compose box for (but prior to sending), text continues to show after clicking into another chat (3 users)

  1. Open a chat with User A
  2. Enter text into the compose box (but do not send)
  3. Switch to chat with User B
  4. Switch to a chat with User C
  5. Notice: Message drafted in compose box to User A continues to show in compose box in chat with User C

Issue 3:

Draft icon continues to show when text does not exist in the compose box

  1. Open a chat with User A
  2. Enter text into the compose box (but do not send), wait 3-5 seconds
  3. Switch to chat with User B
  4. Go back to chat with User A, delete the text drafted in compose box
  5. Switch to chat with User C
  6. Notice: Draft icon continues to show next to User A even though you deleted the text in the compose box

Workaround:

N/A

Platform:

Desktop app v1.0.6-0

Notes/Photos/Videos:

Issue 1: After drafting message text in the compose box for (but prior to sending), text continues to show after clicking into another chat (2 users)**

https://user-images.githubusercontent.com/31225194/112590102-5aa85180-8da6-11eb-90d4-b3cfe1f1d988.mp4

Issue 2: After drafting message text in the compose box for (but prior to sending), text continues to show after clicking into another chat (3 users)

https://user-images.githubusercontent.com/31225194/112589293-f0db7800-8da4-11eb-935a-48ff721c777a.mp4


** Draft icon continues to show when text does not exist in the compose box

https://user-images.githubusercontent.com/31225194/112589862-ed94bc00-8da5-11eb-81b1-d5ce14352df3.mp4

Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/157277

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

3reactions
kidrocacommented, Mar 31, 2021

Hey guys since you will make the component re-mount when reportID changes you can also set the autoFocus attribute which would make it focus after it mounts.

<TextInputFocusable
  autoFocus
  multiline
  ref={el => this.textInput = el}
  ...

Then this condition becomes unneeded (E.g. when reportID changes the compose component would remount)

https://github.com/Expensify/Expensify.cash/blob/62b6920c01cdefbc0fb0c258e4b756bcd01fe12a/src/pages/home/report/ReportActionCompose.js#L84

        if (
            (prevProps.modal.isVisible && !this.props.modal.isVisible)
            || (prevProps.reportID !== this.props.reportID) // this won't be needed 
        ) {
            this.setIsFocused(true);
        }

I’ve proposed a similar idea though it was regarding focusing and keyboard issues on mobile

In short: The ReportView (or screen) will re-mount. This in turn means it’s children will remount too and you won’t need to set a key to force a remount

  • Why does the ReportView need to unmount?
  • To have a smooth transition while we are switching between reports #2154

This can simplify logic like:

  // The first time the component loads the props is empty and the next time it may contain value.
  // If it does let's update this.comment so that it matches the defaultValue that we show in textInput.
  if (this.props.comment && prevProps.comment === '' && prevProps.comment !== this.props.comment) {
      this.comment = this.props.comment;
  }

The parent will first load data (display loading state) and then mount the compose field with a proper initial value.

2reactions
iwizniacommented, Mar 29, 2021

Cool, that makes sense! Go ahead and submit the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

can not open saved message in draft - Microsoft Community
The draft message that was saved on a message i replied too can not be opened the original message can not be opened...
Read more >
Default action "Edit draft message" | Thunderbird Support Forum
First ensure you are using the ALL folders view THe other folder views tend to be built on searches, so when fixing things...
Read more >
Email Not Sending, Going Into The Drafts Folder Instead
First, look at your server connection. A main reason why the email may be going the Drafts folder is its sending through the...
Read more >
Draft Notification in Messages App - Samsung Community
Hello! I would recommend giving this a try. Open up the message that has the draft notification on it. Tap and hold in...
Read more >
Emails fail to send / Sending error/ Emails stay in drafts
This problem is normally caused by incorrect SMTP server settings, or often also by a firewall or antivirus software blocking access. Please try ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found