-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix StagingDeployBlocker where chat draft message is kept in the test input while switching chats #4761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix StagingDeployBlocker where chat draft message is kept in the test input while switching chats #4761
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about updating
this.commentas well in this block or does that not matter? Honestly, I don't totally get why we started usingsetNativeProps()for this in the first place (I think to fix some bug) - but seeing thisupdateComment()makes me think it should be the one used here:App/src/pages/home/report/ReportActionCompose.js
Lines 312 to 320 in 9135cfb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I have not considered the
updateComment(), but I agree now it might be better. I was trying to go with as small change as possible because I have tried updatingthis.commenttoo, but it worked the same as without explicitly updating it, so I took it away.I can submit a PR to use updateComment function and leave it in
mainand not CP as the functionality is same for now (at least what I could have seen myself).I thought this would only be a temporary workaround because the componentDidUpdate function is called many times so we should aim to put as little logic in there as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good to me. One reason why I would maybe use this is that if we refactor or change the
setNativePropsthing in the future there will be only one place where we did it. Or said another way setting the native props is feels like more of a "detail" of the "update comment" code we are running.I'm curious what would the real solution be? It's fine to have logic in this method as long as we check when we should run it e.g. if we only need this to happen when the report switches then maybe it would be better to look at another prop besides the comment. I have one in mind... :)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a PR here 🙌
You are right there could be some hidden problem along the way by using solely the ref to update it. I think the reason it work d is that the component gets to the correct state eventually, but there is the couple of renders, which are still with the old
reportID, which are causing the initial bug.Thank you for the sneaky hint :) I have used
this.props.report.reportID, because thereportIDchanges before thethis.props.reportis updated to the correct one and thus the bug would prevail.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss this in the new PR. I'm not sure I am getting why the
reportIDitself could not be used 🤔