Additional render optimizations
This commit is contained in:
parent
6343e7c902
commit
7a8363c7c8
4 changed files with 93 additions and 70 deletions
|
@ -7,6 +7,11 @@ import { StateType as RootStateType } from '../reducer';
|
|||
import { AttachmentType } from '../../types/Attachment';
|
||||
import { MessageAttributesType } from '../../model-types.d';
|
||||
import { LinkPreviewWithDomain } from '../../types/LinkPreview';
|
||||
import { assignWithNoUnnecessaryAllocation } from '../../util/assignWithNoUnnecessaryAllocation';
|
||||
import {
|
||||
REMOVE_PREVIEW as REMOVE_LINK_PREVIEW,
|
||||
RemoveLinkPreviewActionType,
|
||||
} from './linkPreviews';
|
||||
|
||||
// State
|
||||
|
||||
|
@ -58,6 +63,7 @@ type ComposerActionType =
|
|||
| ResetComposerActionType
|
||||
| SetHighQualitySettingActionType
|
||||
| SetLinkPreviewResultActionType
|
||||
| RemoveLinkPreviewActionType
|
||||
| SetQuotedMessageActionType;
|
||||
|
||||
// Action Creators
|
||||
|
@ -176,5 +182,12 @@ export function reducer(
|
|||
};
|
||||
}
|
||||
|
||||
if (action.type === REMOVE_LINK_PREVIEW) {
|
||||
return assignWithNoUnnecessaryAllocation(state, {
|
||||
linkPreviewLoading: false,
|
||||
linkPreviewResult: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue