Combine two redux batches in send flow
This commit is contained in:
parent
494287a570
commit
7afe3fcca2
2 changed files with 12 additions and 10 deletions
|
@ -3944,11 +3944,13 @@ export class ConversationModel extends window.Backbone
|
||||||
sendHQImages,
|
sendHQImages,
|
||||||
storyId,
|
storyId,
|
||||||
timestamp,
|
timestamp,
|
||||||
|
extraReduxActions,
|
||||||
}: {
|
}: {
|
||||||
dontClearDraft?: boolean;
|
dontClearDraft?: boolean;
|
||||||
sendHQImages?: boolean;
|
sendHQImages?: boolean;
|
||||||
storyId?: string;
|
storyId?: string;
|
||||||
timestamp?: number;
|
timestamp?: number;
|
||||||
|
extraReduxActions?: () => void;
|
||||||
} = {}
|
} = {}
|
||||||
): Promise<MessageAttributesType | undefined> {
|
): Promise<MessageAttributesType | undefined> {
|
||||||
if (this.isGroupV1AndDisabled()) {
|
if (this.isGroupV1AndDisabled()) {
|
||||||
|
@ -4118,6 +4120,8 @@ export class ConversationModel extends window.Backbone
|
||||||
if (enableProfileSharing) {
|
if (enableProfileSharing) {
|
||||||
this.captureChange('mandatoryProfileSharing');
|
this.captureChange('mandatoryProfileSharing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extraReduxActions?.();
|
||||||
} finally {
|
} finally {
|
||||||
this.isInReduxBatch = false;
|
this.isInReduxBatch = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
||||||
import { batch as batchDispatch } from 'react-redux';
|
|
||||||
import { debounce, flatten, omit, throttle } from 'lodash';
|
import { debounce, flatten, omit, throttle } from 'lodash';
|
||||||
import { render } from 'mustache';
|
import { render } from 'mustache';
|
||||||
|
|
||||||
|
@ -2969,17 +2968,16 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
||||||
{
|
{
|
||||||
sendHQImages,
|
sendHQImages,
|
||||||
timestamp,
|
timestamp,
|
||||||
|
extraReduxActions: () => {
|
||||||
|
this.compositionApi.current?.reset();
|
||||||
|
model.setMarkedUnread(false);
|
||||||
|
this.setQuoteMessage(null);
|
||||||
|
this.resetLinkPreview();
|
||||||
|
this.clearAttachments();
|
||||||
|
window.reduxActions.composer.resetComposer();
|
||||||
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
batchDispatch(() => {
|
|
||||||
this.compositionApi.current?.reset();
|
|
||||||
model.setMarkedUnread(false);
|
|
||||||
this.setQuoteMessage(null);
|
|
||||||
this.resetLinkPreview();
|
|
||||||
this.clearAttachments();
|
|
||||||
window.reduxActions.composer.resetComposer();
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
'Error pulling attached files before send',
|
'Error pulling attached files before send',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue