Draft message feature not working correctly
See original GitHub issueIf 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)
- Open a chat with
User A
- Enter text into the compose box (but do not send)
- Switch to chat with
User B
- Notice: Message drafted in compose box to
User A
continues to show in compose box in chat withUser 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)
- Open a chat with
User A
- Enter text into the compose box (but do not send)
- Switch to chat with
User B
- Switch to a chat with
User C
- Notice: Message drafted in compose box to
User A
continues to show in compose box in chat withUser C
Issue 3:
Draft icon continues to show when text does not exist in the compose box
- Open a chat with
User A
- Enter text into the compose box (but do not send), wait 3-5 seconds
- Switch to chat with
User B
- Go back to chat with
User A
, delete the text drafted in compose box - Switch to chat with
User C
- 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)**
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)
** Draft icon continues to show when text does not exist in the compose box
Expensify/Expensify Issue URL: https://github.com/Expensify/Expensify/issues/157277
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:19 (19 by maintainers)
Top GitHub Comments
Hey guys since you will make the component re-mount when
reportID
changes you can also set theautoFocus
attribute which would make it focus after it mounts.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
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 akey
to force a remountReportView
need to unmount?This can simplify logic like:
The parent will first load data (display loading state) and then mount the compose field with a proper initial value.
Cool, that makes sense! Go ahead and submit the PR.