Use react-redux's batch instead of react's

This commit is contained in:
Fedor Indutny 2021-11-01 16:38:08 -07:00 committed by GitHub
parent 3190f95fac
commit 663cd77eac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 123 additions and 66 deletions

View file

@ -3,7 +3,7 @@
/* eslint-disable camelcase */
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
import { batch as batchDispatch } from 'react-redux';
import { debounce, flatten, omit, throttle } from 'lodash';
import { render } from 'mustache';
@ -3273,20 +3273,20 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
log.info('Send pre-checks took', sendDelta, 'milliseconds');
batchedUpdates(() => {
model.enqueueMessageForSend(
message,
attachments,
this.quote,
this.getLinkPreviewForSend(message),
undefined, // sticker
mentions,
{
sendHQImages,
timestamp,
}
);
model.enqueueMessageForSend(
message,
attachments,
this.quote,
this.getLinkPreviewForSend(message),
undefined, // sticker
mentions,
{
sendHQImages,
timestamp,
}
);
batchDispatch(() => {
this.compositionApi.current?.reset();
model.setMarkedUnread(false);
this.setQuoteMessage(null);