-
Notifications
You must be signed in to change notification settings - Fork 283
fix: await word replace before submitting message #2332
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
Conversation
This file contains 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
Size Change: +68 B (0%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
oliverlaz
approved these changes
Mar 19, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2332 +/- ##
=======================================
Coverage 84.99% 84.99%
=======================================
Files 353 353
Lines 7945 7945
Branches 2077 2077
=======================================
Hits 6753 6753
Misses 1010 1010
Partials 182 182 ☔ View full report in Codecov by Sentry. |
🎉 This PR is included in version 11.12.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Mar 19, 2024
myandrienko
added a commit
that referenced
this pull request
May 1, 2024
React 16 had a wacky thing called [event pooling](https://legacy.reactjs.org/docs/legacy-event-pooling.html). Basically you couldn't use event objects outside of the microtask in which the event handler was triggered, unless you explicitly called `event.persist()`. When we made key down handler on message input async in #2332, we broke this rule. So `preventDefault()` in [submit handler](https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageInput/hooks/useSubmitHandler.ts#L119) became a no-op. React still provides the `perist()` method on synthetic events, even in newer versions, so we just use it to fix the issue.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🎯 Goal
Fixes a race condition with emoji auto-replacement when submitting a message.
🛠 Implementation details
_replaceWord
is an async method, we should await it before submitting.🎨 UI Changes
Before:
Screen.Recording.2024-03-19.at.14.07.35.mov
After:
Screen.Recording.2024-03-19.at.14.05.55.mov
To-Do