[Refactoring] Remove unused parameters (#3396)

This commit is contained in:
Alexander Zinchuk 2023-07-05 13:14:10 +02:00
parent 6a47d14388
commit 44060a239e
12 changed files with 10 additions and 17 deletions

View File

@ -50,7 +50,8 @@
"getActions": true,
"useFlag": [false, true, true],
"useForceUpdate": true,
"useReducer": [false, true]
"useReducer": [false, true],
"useLastCallback": true
}
}
],

View File

@ -128,7 +128,7 @@ const ProfileInfo: FC<OwnProps & StateProps> = ({
}
}, [userId, loadFullUser, connectionState, forceShowSelf]);
usePhotosPreload(user || chat, photos, currentPhotoIndex);
usePhotosPreload(photos, currentPhotoIndex);
const handleProfilePhotoClick = useLastCallback(() => {
openMediaViewer({

View File

@ -1,4 +1,4 @@
import type { ApiChat, ApiPhoto, ApiUser } from '../../../api/types';
import type { ApiPhoto } from '../../../api/types';
import { ApiMediaFormat } from '../../../api/types';
import { useEffect } from '../../../lib/teact/teact';
import * as mediaLoader from '../../../util/mediaLoader';
@ -6,7 +6,6 @@ import * as mediaLoader from '../../../util/mediaLoader';
const PHOTOS_TO_PRELOAD = 4;
export default function usePhotosPreload(
profile: ApiUser | ApiChat | undefined,
photos: ApiPhoto[],
currentIndex: number,
) {

View File

@ -83,9 +83,7 @@ const MediaViewerSlides: FC<OwnProps> = ({
selectMedia,
isVideo,
isGif,
isPhoto,
isOpen,
hasFooter,
withAnimation,
isHidden,
...rest

View File

@ -104,7 +104,7 @@ const ActionMessage: FC<OwnProps & StateProps> = ({
useOnIntersect(ref, observeIntersectionForReading);
useEnsureMessage(message.chatId, message.replyToMessageId, targetMessage);
useFocusMessage(ref, message.id, message.chatId, isFocused, focusDirection, noFocusHighlight, isJustAdded);
useFocusMessage(ref, message.chatId, isFocused, focusDirection, noFocusHighlight, isJustAdded);
useEffect(() => {
if (!message.isPinned) return undefined;

View File

@ -65,7 +65,7 @@ const Invoice: FC<OwnProps> = ({
if (photoUrl) {
const contentEl = ref.current!.closest<HTMLDivElement>(MESSAGE_CONTENT_SELECTOR)!;
getCustomAppendixBg(photoUrl, false, isInSelectMode, isSelected, theme).then((appendixBg) => {
getCustomAppendixBg(photoUrl, false, isSelected, theme).then((appendixBg) => {
contentEl.style.setProperty('--appendix-bg', appendixBg);
contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');
});

View File

@ -502,7 +502,6 @@ const Message: FC<OwnProps & StateProps> = ({
selectMessage,
ref,
messageId,
isAlbum,
Boolean(isInSelectMode),
Boolean(canReply),
Boolean(isProtected),
@ -511,7 +510,6 @@ const Message: FC<OwnProps & StateProps> = ({
chatId,
isContextMenuShown,
quickReactionRef,
isOwn,
isInDocumentGroupNotLast,
);
@ -670,7 +668,7 @@ const Message: FC<OwnProps & StateProps> = ({
);
useFocusMessage(
ref, messageId, chatId, isFocused, focusDirection, noFocusHighlight, isResizingContainer, isJustAdded,
ref, chatId, isFocused, focusDirection, noFocusHighlight, isResizingContainer, isJustAdded,
);
const signature = (isChannel && message.postAuthorTitle)

View File

@ -158,7 +158,7 @@ const Photo: FC<OwnProps> = ({
const contentEl = ref.current!.closest<HTMLDivElement>(MESSAGE_CONTENT_SELECTOR)!;
if (fullMediaData) {
getCustomAppendixBg(fullMediaData, isOwn, isInSelectMode, isSelected, theme).then((appendixBg) => {
getCustomAppendixBg(fullMediaData, isOwn, isSelected, theme).then((appendixBg) => {
requestMutation(() => {
contentEl.style.setProperty('--appendix-bg', appendixBg);
contentEl.setAttribute(CUSTOM_APPENDIX_ATTRIBUTE, '');

View File

@ -12,7 +12,7 @@ const SELECTED_APPENDIX_COLORS = {
};
export default function getCustomAppendixBg(
src: string, isOwn: boolean, inSelectMode?: boolean, isSelected?: boolean, theme?: ISettings['theme'],
src: string, isOwn: boolean, isSelected?: boolean, theme?: ISettings['theme'],
) {
if (isSelected) {
return Promise.resolve(SELECTED_APPENDIX_COLORS[theme || 'light'][isOwn ? 'outgoing' : 'incoming']);

View File

@ -12,7 +12,6 @@ const FOCUS_MARGIN = 20;
export default function useFocusMessage(
elementRef: { current: HTMLDivElement | null },
messageId: number,
chatId: string,
isFocused?: boolean,
focusDirection?: FocusDirection,

View File

@ -24,7 +24,6 @@ export default function useOuterHandlers(
selectMessage: (e?: React.MouseEvent<HTMLDivElement, MouseEvent>, groupedId?: string) => void,
containerRef: RefObject<HTMLDivElement>,
messageId: number,
isAlbum: boolean,
isInSelectMode: boolean,
canReply: boolean,
isProtected: boolean,
@ -33,7 +32,6 @@ export default function useOuterHandlers(
chatId: string,
isContextMenuShown: boolean,
quickReactionRef: RefObject<HTMLDivElement>,
isOwn: boolean,
shouldHandleMouseLeave: boolean,
) {
const { setReplyingToId, sendDefaultReaction } = getActions();

View File

@ -493,7 +493,7 @@ export function updateThreadInfos<T extends GlobalState>(
global: T, chatId: string, updates: Partial<ApiThreadInfo>[],
): T {
updates.forEach((update) => {
global = updateThreadInfo(global, update.chatId!, update.threadId!, update);
global = updateThreadInfo(global, chatId, update.threadId!, update);
});
return global;