App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-12-15] $500 Chat Switcher - Draft message from previous conv is displayed after using chat switcher

Open isagoico opened this issue 5 years ago β€’ 42 comments

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.

  1. Navigate to a conversation
  2. Write something in compose box
  3. Use ctrl+k command
  4. 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:

View all open jobs on GitHub


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

isagoico avatar Aug 19 '21 17:08 isagoico

Triggered auto assignment to @mountiny (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

MelvinBot avatar Aug 19 '21 17:08 MelvinBot

: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:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

OSBotify avatar Aug 19 '21 17:08 OSBotify

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.

mountiny avatar Aug 19 '21 19:08 mountiny

It seems that with https://github.com/Expensify/App/pull/4538 ReportActionCompose no longer mounts and the input ref is lost in the update.

luacmartins avatar Aug 19 '21 22:08 luacmartins

Why is the input not mounting? Which ref are you referring to?

marcaaron avatar Aug 19 '21 22:08 marcaaron

When the chat is switch using the search bar didComponentMount is not triggered for ReportActionCompose and this inputRef does not seem to update.

luacmartins avatar Aug 19 '21 22:08 luacmartins

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

marcaaron avatar Aug 19 '21 23:08 marcaaron

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.

luacmartins avatar Aug 19 '21 23:08 luacmartins

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.

mountiny avatar Aug 20 '21 13:08 mountiny

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.

mountiny avatar Aug 20 '21 14:08 mountiny

Retest for this in Web was a pass πŸŽ‰

isagoico avatar Aug 20 '21 18:08 isagoico

πŸš€ Deployed to production by @roryabraham in version: 1.0.88-2 πŸš€

platform result
πŸ€– android πŸ€– success βœ…
πŸ–₯ desktop πŸ–₯ success βœ…
🍎 iOS 🍎 failure ❌
πŸ•Έ web πŸ•Έ success βœ…

botify avatar Aug 30 '21 17:08 botify

Regression? Looks like it's happening again https://expensify.slack.com/archives/C01GTK53T8Q/p1634576408421600

mallenexpensify avatar Oct 19 '21 12:10 mallenexpensify

This is only happening with Chronos conversation at the moment. Other conversations are working as expected

Action performed:

  1. Navigate to Chronos conversation
  2. Draft a message
  3. Hit ctrl + K
  4. Change to another chat

https://user-images.githubusercontent.com/44479856/137920267-eabf547b-2156-46df-a71c-c10e71d427a5.mp4

isagoico avatar Oct 19 '21 13:10 isagoico

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.

mountiny avatar Oct 19 '21 15:10 mountiny

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

MelvinBot avatar Oct 19 '21 17:10 MelvinBot

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.

mountiny avatar Oct 19 '21 17:10 mountiny

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

mountiny avatar Oct 19 '21 17:10 mountiny

https://www.upwork.com/jobs/~01e5dccfcff059ed0f

laurenreidexpensify avatar Oct 19 '21 17:10 laurenreidexpensify

Still waiting for proposals here πŸ™‡

mountiny avatar Oct 26 '21 10:10 mountiny