[Perf] Add memo to many components

This commit is contained in:
Alexander Zinchuk 2021-05-09 01:59:55 +03:00
parent b88822d216
commit 4e0f4d99e8
46 changed files with 92 additions and 92 deletions

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const AuthCodeAsync: FC = () => {
return AuthCode ? <AuthCode /> : <Loading />;
};
export default AuthCodeAsync;
export default memo(AuthCodeAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const AuthPasswordAsync: FC = () => {
return AuthPassword ? <AuthPassword /> : <Loading />;
};
export default AuthPasswordAsync;
export default memo(AuthPasswordAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const AuthQrCodeAsync: FC = () => {
return AuthQrCode ? <AuthQrCode /> : <Loading />;
};
export default AuthQrCodeAsync;
export default memo(AuthQrCodeAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const AuthRegisterAsync: FC = () => {
return AuthRegister ? <AuthRegister /> : <Loading />;
};
export default AuthRegisterAsync;
export default memo(AuthRegisterAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './CalendarModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const CalendarModalAsync: FC<OwnProps> = (props) => {
return CalendarModal ? <CalendarModal {...props} /> : undefined;
};
export default CalendarModalAsync;
export default memo(CalendarModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './DeleteMessageModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const DeleteMessageModalAsync: FC<OwnProps> = (props) => {
return DeleteMessageModal ? <DeleteMessageModal {...props} /> : undefined;
};
export default DeleteMessageModalAsync;
export default memo(DeleteMessageModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { ApiMessage, ApiMessageOutgoingStatus } from '../../api/types';
import { formatPastTimeShort } from '../../util/dateFormat';
@ -21,4 +21,4 @@ const LastMessageMeta: FC<OwnProps> = ({ message, outgoingStatus }) => {
);
};
export default LastMessageMeta;
export default memo(LastMessageMeta);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { ApiMessageOutgoingStatus } from '../../api/types';
@ -26,4 +26,4 @@ const MessageOutgoingStatus: FC<OwnProps> = ({ status }) => {
);
};
export default MessageOutgoingStatus;
export default memo(MessageOutgoingStatus);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './PinMessageModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const PinMessageModalAsync: FC<OwnProps> = (props) => {
return PinMessageModal ? <PinMessageModal {...props} /> : undefined;
};
export default PinMessageModalAsync;
export default memo(PinMessageModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './StickerSetModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const StickerSetModalAsync: FC<OwnProps> = (props) => {
return StickerSetModal ? <StickerSetModal {...props} /> : undefined;
};
export default StickerSetModalAsync;
export default memo(StickerSetModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './UnpinAllMessagesModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const UnpinAllMessagesModalAsync: FC<OwnProps> = (props) => {
return UnpinAllMessagesModal ? <UnpinAllMessagesModal {...props} /> : undefined;
};
export default UnpinAllMessagesModalAsync;
export default memo(UnpinAllMessagesModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './ArchivedChats';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const ArchivedChatsAsync: FC<OwnProps> = (props) => {
return ArchivedChats ? <ArchivedChats {...props} /> : <Loading />;
};
export default ArchivedChatsAsync;
export default memo(ArchivedChatsAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { ApiChat } from '../../../api/types';
@ -65,4 +65,4 @@ const Badge: FC<OwnProps> = ({ chat, isPinned }) => {
);
};
export default Badge;
export default memo(Badge);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './ContactList';
@ -12,4 +12,4 @@ const ContactListAsync: FC<OwnProps> = (props) => {
return ContactList ? <ContactList {...props} /> : <Loading />;
};
export default ContactListAsync;
export default memo(ContactListAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './NewChat';
@ -13,4 +13,4 @@ const NewChatAsync: FC<OwnProps> = (props) => {
return NewChat ? <NewChat {...props} /> : <Loading />;
};
export default NewChatAsync;
export default memo(NewChatAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './NewChatStep1';
@ -13,4 +13,4 @@ const NewChatStep1Async: FC<OwnProps> = (props) => {
return NewChatStep1 ? <NewChatStep1 {...props} /> : <Loading />;
};
export default NewChatStep1Async;
export default memo(NewChatStep1Async);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './NewChatStep2';
@ -13,4 +13,4 @@ const NewChatStep2Async: FC<OwnProps> = (props) => {
return NewChatStep2 ? <NewChatStep2 {...props} /> : <Loading />;
};
export default NewChatStep2Async;
export default memo(NewChatStep2Async);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './LeftSearch';
@ -12,4 +12,4 @@ const LeftSearchAsync: FC<OwnProps> = (props) => {
return LeftSearch ? <LeftSearch {...props} /> : <Loading />;
};
export default LeftSearchAsync;
export default memo(LeftSearchAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './Settings';
@ -13,4 +13,4 @@ const SettingsAsync: FC<OwnProps> = (props) => {
return Settings ? <Settings {...props} /> : <Loading />;
};
export default SettingsAsync;
export default memo(SettingsAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const ErrorsAsync: FC = ({ isOpen }) => {
return Errors ? <Errors /> : undefined;
};
export default ErrorsAsync;
export default memo(ErrorsAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import { OwnProps } from './ForwardPicker';
@ -12,4 +12,4 @@ const ForwardPickerAsync: FC<OwnProps> = (props) => {
return ForwardPicker ? <ForwardPicker {...props} /> : undefined;
};
export default ForwardPickerAsync;
export default memo(ForwardPickerAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -9,4 +9,4 @@ const MainAsync: FC = () => {
return Main ? <Main /> : undefined;
};
export default MainAsync;
export default memo(MainAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const NotificationsAsync: FC = ({ isOpen }) => {
return Notifications ? <Notifications /> : undefined;
};
export default NotificationsAsync;
export default memo(NotificationsAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './HeaderMenuContainer';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const HeaderMenuContainerAsync: FC<OwnProps> = (props) => {
return HeaderMenuContainer ? <HeaderMenuContainer {...props} /> : undefined;
};
export default HeaderMenuContainerAsync;
export default memo(HeaderMenuContainerAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import { OwnProps } from './MessageSelectToolbar';
@ -12,4 +12,4 @@ const MessageSelectToolbarAsync: FC<OwnProps> = (props) => {
return MessageSelectToolbar ? <MessageSelectToolbar {...props} /> : undefined;
};
export default MessageSelectToolbarAsync;
export default memo(MessageSelectToolbarAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './MobileSearch';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const MobileSearchAsync: FC<OwnProps> = (props) => {
return MobileSearch ? <MobileSearch {...props} /> : undefined;
};
export default MobileSearchAsync;
export default memo(MobileSearchAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './AttachMenu';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const AttachMenuAsync: FC<OwnProps> = (props) => {
return AttachMenu ? <AttachMenu {...props} /> : undefined;
};
export default AttachMenuAsync;
export default memo(AttachMenuAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './AttachmentModal';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const AttachmentModalAsync: FC<OwnProps> = (props) => {
return AttachmentModal ? <AttachmentModal {...props} /> : undefined;
};
export default AttachmentModalAsync;
export default memo(AttachmentModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './BotKeyboardMenu';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const BotKeyboardMenuAsync: FC<OwnProps> = (props) => {
return BotKeyboardMenu ? <BotKeyboardMenu {...props} /> : undefined;
};
export default BotKeyboardMenuAsync;
export default memo(BotKeyboardMenuAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './CustomSendMenu';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const CustomSendMenuAsync: FC<OwnProps> = (props) => {
return CustomSend ? <CustomSend {...props} /> : undefined;
};
export default CustomSendMenuAsync;
export default memo(CustomSendMenuAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './DropArea';
import { Bundles } from '../../../util/moduleLoader';
@ -12,5 +12,5 @@ const DropAreaAsync: FC<OwnProps> = (props) => {
return DropArea ? <DropArea {...props} /> : undefined;
};
export default DropAreaAsync;
export default memo(DropAreaAsync);
export { DropAreaState } from './DropArea';

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './EmojiTooltip';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const EmojiTooltipAsync: FC<OwnProps> = (props) => {
return EmojiTooltip ? <EmojiTooltip {...props} /> : undefined;
};
export default EmojiTooltipAsync;
export default memo(EmojiTooltipAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './MentionMenu';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const MentionMenuAsync: FC<OwnProps> = (props) => {
return MentionMenu ? <MentionMenu {...props} /> : undefined;
};
export default MentionMenuAsync;
export default memo(MentionMenuAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './PollModal';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const PollModalAsync: FC<OwnProps> = (props) => {
return PollModal ? <PollModal {...props} /> : undefined;
};
export default PollModalAsync;
export default memo(PollModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './SymbolMenu';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const SymbolMenuAsync: FC<OwnProps> = (props) => {
return SymbolMenu ? <SymbolMenu {...props} /> : undefined;
};
export default SymbolMenuAsync;
export default memo(SymbolMenuAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './TextFormatter';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const TextFormatterAsync: FC<OwnProps> = (props) => {
return TextFormatter ? <TextFormatter {...props} /> : undefined;
};
export default TextFormatterAsync;
export default memo(TextFormatterAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { OwnProps } from './ContextMenuContainer';
import { Bundles } from '../../../util/moduleLoader';
@ -12,4 +12,4 @@ const ContextMenuContainerAsync: FC<OwnProps> = (props) => {
return ContextMenuContainer ? <ContextMenuContainer {...props} /> : undefined;
};
export default ContextMenuContainerAsync;
export default memo(ContextMenuContainerAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { ApiMessage, ApiMessageOutgoingStatus } from '../../../api/types';
@ -47,4 +47,4 @@ const MessageMeta: FC<OwnProps> = ({
);
};
export default MessageMeta;
export default memo(MessageMeta);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './PaymentModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const PaymentModalAsync: FC<OwnProps> = (props) => {
return PaymentModal ? <PaymentModal {...props} /> : undefined;
};
export default PaymentModalAsync;
export default memo(PaymentModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './ReceiptModal';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const ReceiptModalAsync: FC<OwnProps> = (props) => {
return ReceiptModal ? <ReceiptModal {...props} /> : undefined;
};
export default ReceiptModalAsync;
export default memo(ReceiptModalAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -11,4 +11,4 @@ const GifSearchAsync: FC = () => {
return GifSearch ? <GifSearch /> : <Loading />;
};
export default GifSearchAsync;
export default memo(GifSearchAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -10,4 +10,4 @@ const PollResultsAsync: FC = () => {
return PollResults ? <PollResults /> : <Loading />;
};
export default PollResultsAsync;
export default memo(PollResultsAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { OwnProps } from './RightSearch';
import { Bundles } from '../../util/moduleLoader';
@ -12,4 +12,4 @@ const RightSearchAsync: FC<OwnProps> = (props) => {
return RightSearch ? <RightSearch {...props} /> : <Loading />;
};
export default RightSearchAsync;
export default memo(RightSearchAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../lib/teact/teact';
import React, { FC, memo } from '../../lib/teact/teact';
import { Bundles } from '../../util/moduleLoader';
import useModuleLoader from '../../hooks/useModuleLoader';
@ -11,4 +11,4 @@ const StickerSearchAsync: FC = () => {
return StickerSearch ? <StickerSearch /> : <Loading />;
};
export default StickerSearchAsync;
export default memo(StickerSearchAsync);

View File

@ -1,4 +1,4 @@
import React, { FC } from '../../../lib/teact/teact';
import React, { FC, memo } from '../../../lib/teact/teact';
import { Bundles } from '../../../util/moduleLoader';
import { OwnProps } from './Management';
@ -14,4 +14,4 @@ const ManagementAsync: FC<OwnProps> = (props) => {
return Management ? <Management {...props} /> : <Loading />;
};
export default ManagementAsync;
export default memo(ManagementAsync);

View File

@ -1,5 +1,5 @@
import React, {
FC, useCallback, useMemo, useState,
FC, useCallback, useMemo, useState, memo,
} from '../../lib/teact/teact';
import { debounce } from '../../util/schedulers';
@ -58,4 +58,4 @@ const RippleEffect: FC = () => {
);
};
export default RippleEffect;
export default memo(RippleEffect);