[HOLD for payment 2021-12-15] $500 Chat Switcher - Draft message from previous conv is displayed after using chat switcher
If you havenβt already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel! https://www.upwork.com/jobs/~01e5dccfcff059ed0f
Action Performed:
Please, see this comment for further investigation and reproduction steps. Some of the hints might helps us find what is exactly going wrong.
- Navigate to a conversation
- Write something in compose box
- Use ctrl+k command
- Select another conversation
Expected Result:
Nothing should be displayed in compose box if the selected conversation didn't have a draft
Actual Result:
The draft from the previous conversation is displayed on the current conversation.
Workaround:
For chats with people which they have already chatted with, they can use the LHN chat switcher and the drafts are not transferred. Also when user sends a message to someone or composes a draft which is then deleted, they wont experience this bug for the given chat.
When this will prevail is in case user creates chat with new person using the Ctrl + k chat switcher.
Platform:
Where is this issue occurring?
- Web
- Desktop App
Version Number: 1.0.86-2
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://user-images.githubusercontent.com/44479856/130116621-e5c335f4-5289-4819-9864-5b7de148be3f.mp4
Expensify/Expensify Issue URL:
From @iwiznia https://expensify.slack.com/archives/C01GTK53T8Q/p1629393716037000
BUG: (tested on web, staging, probably deploy blocker): draft is not working properly. Steps: Write something in the chat but don't send it Switch to another chat using CMD+K shortcut See that draft message is carried over to the chat you switched, when it should not
Triggered auto assignment to @mountiny (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
:wave: Friendly reminder that deploy blockers are time-sensitive β± issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
- Identify the pull request that introduced this issue and revert it.
- Find someone who can quickly fix the issue.
- Fix the issue yourself.
The only PR which might be related to this and could introduced it is https://github.com/Expensify/App/pull/4538 @marcaaron but I am not completely sure. What do you think? I can't really dig into this one right now. I would in the morning if noone identifies what is causing it π Thank you in any case for having a look.
It seems that with https://github.com/Expensify/App/pull/4538 ReportActionCompose no longer mounts and the input ref is lost in the update.
Why is the input not mounting? Which ref are you referring to?
When the chat is switch using the search bar didComponentMount is not triggered for ReportActionCompose and this inputRef does not seem to update.
The ReportActionCompose component should be mounting only once now. Is there some reason it needs to be unmounted and remounted? I'm not seeing it yet...
I agree that it should be mounted only once and we should keep it that way. What seems to be causing this issue is that this.setInputRef is not providing the correct ref to TextInputFocusable. Both this.props.comment and defaultValue are correct when switching chats with the Search Page, so I'm not sure why the value is not updated.
Thank you both for looking into this! Following from what you have found @luacmartins, I have identified that when using the SearchBar, the ReportActionCompose does need to update couple of time (after selecting different chat from the search) before it gets the report data of the new report.
In comparison, when using sidebar chat switcher, the components gets the correct props immediately after switching as it mounts.
I haven't been able to easily revert that PR either because it seems there were some additional ONYX changes made after it, which make the ReportActionsView not render correctly.
Therefore, I have tried to find some possibly temporary workaround, before @marcaaron might be able to look into how to update the refactoring to prevent this problem.
PR is ready for a review, but it still needs to be tested on Mobile to make sure the workaround does not cause any problems.
Retest for this in Web was a pass π
π Deployed to production by @roryabraham in version: 1.0.88-2 π
| platform | result |
|---|---|
| π€ android π€ | success β |
| π₯ desktop π₯ | success β |
| π iOS π | failure β |
| πΈ web πΈ | success β |
Regression? Looks like it's happening again https://expensify.slack.com/archives/C01GTK53T8Q/p1634576408421600
This is only happening with Chronos conversation at the moment. Other conversations are working as expected
Action performed:
- Navigate to Chronos conversation
- Draft a message
- Hit ctrl + K
- Change to another chat
https://user-images.githubusercontent.com/44479856/137920267-eabf547b-2156-46df-a71c-c10e71d427a5.mp4
Looking into this, it has some weird reproduction steps on dev. It does not fail (carries the draft over to other chat) every time using the chat switcher. I have removed the deploy blocker label as I think it is very important, but it should not be a blocker.
I am looking into this now.
Triggered auto assignment to @laurenreidexpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
I think we can make this External and I will bypass the process and add the Help Wanted label due to urgency.
I will leave my notes from investigation below shortly.
I have confirmed that in the PR which has been merged to close this issue originally, this problem didi not exist. Therefore, it must have been introduced as a regression from some PR since then.
Investigation
Please, see the screen recording to follow with what I describe. The draft messages seems to stay in the composer box for chats, when switching into a chat which have not yet had a message sent or deleted (compose and delete it).
Therefore, this problem prevails when (after reloading a page), user composes a message and then uses the chat switcher to go to some other chat they have not touched yet.
- if you send a message in some chat (or compose a draft and delete it consequently), then navigating to such a chat from some chat with a draft will not transfer the draft message.
Idea
That makes me think we must have changed something about an initial state of a draft for a comment or how we handle the drafts in Onyx, that this happens only in case we transfer into chat which we have not interacted with.
I assume we could look into what is happening when we delete a draft or send a message, such that this bug is then not reproducible if we do so.
https://user-images.githubusercontent.com/36083550/137957671-dcaf40ed-15a8-4278-bf38-786d37fa48fd.mov
https://www.upwork.com/jobs/~01e5dccfcff059ed0f
Still waiting for proposals here π