mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 04:45:08 +01:00
Message List: Drop redundant code
This commit is contained in:
parent
ab9cef0f13
commit
49e3ec5e93
@ -327,11 +327,6 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
const container = containerRef.current!;
|
const container = containerRef.current!;
|
||||||
listItemElementsRef.current = Array.from(container.querySelectorAll<HTMLDivElement>('.message-list-item'));
|
listItemElementsRef.current = Array.from(container.querySelectorAll<HTMLDivElement>('.message-list-item'));
|
||||||
|
|
||||||
// TODO Consider removing
|
|
||||||
if (!container.offsetParent) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasLastMessageChanged = (
|
const hasLastMessageChanged = (
|
||||||
messageIds && prevMessageIds && messageIds[messageIds.length - 1] !== prevMessageIds[prevMessageIds.length - 1]
|
messageIds && prevMessageIds && messageIds[messageIds.length - 1] !== prevMessageIds[prevMessageIds.length - 1]
|
||||||
);
|
);
|
||||||
@ -362,8 +357,7 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { scrollTop, scrollHeight, offsetHeight } = container;
|
const { scrollTop, scrollHeight, offsetHeight } = container;
|
||||||
// TODO Consider `scrollOffset = scrollHeight - scrollTop`
|
const scrollOffset = scrollOffsetRef.current;
|
||||||
const scrollOffset = scrollOffsetRef.current!;
|
|
||||||
const lastItemElement = listItemElementsRef.current[listItemElementsRef.current.length - 1];
|
const lastItemElement = listItemElementsRef.current[listItemElementsRef.current.length - 1];
|
||||||
|
|
||||||
let bottomOffset = scrollOffset - (prevContainerHeight || offsetHeight);
|
let bottomOffset = scrollOffset - (prevContainerHeight || offsetHeight);
|
||||||
@ -405,8 +399,7 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isResized = prevContainerHeight !== undefined && prevContainerHeight !== containerHeight;
|
const isResized = prevContainerHeight !== undefined && prevContainerHeight !== containerHeight;
|
||||||
// TODO Look up within active transition slide
|
const anchor = anchorIdRef.current && container.querySelector(`#${anchorIdRef.current}`);
|
||||||
const anchor = anchorIdRef.current && document.getElementById(anchorIdRef.current);
|
|
||||||
const unreadDivider = (
|
const unreadDivider = (
|
||||||
!anchor
|
!anchor
|
||||||
&& memoUnreadDividerBeforeIdRef.current
|
&& memoUnreadDividerBeforeIdRef.current
|
||||||
|
@ -6,9 +6,8 @@ import { LoadMoreDirection } from '../../../types';
|
|||||||
import { MessageListType } from '../../../global/types';
|
import { MessageListType } from '../../../global/types';
|
||||||
|
|
||||||
import { LOCAL_MESSAGE_ID_BASE, MESSAGE_LIST_SLICE } from '../../../config';
|
import { LOCAL_MESSAGE_ID_BASE, MESSAGE_LIST_SLICE } from '../../../config';
|
||||||
import { IS_MAC_OS, IS_SCROLL_PATCH_NEEDED, MESSAGE_LIST_SENSITIVE_AREA } from '../../../util/environment';
|
import { IS_SCROLL_PATCH_NEEDED, MESSAGE_LIST_SENSITIVE_AREA } from '../../../util/environment';
|
||||||
import { debounce } from '../../../util/schedulers';
|
import { debounce } from '../../../util/schedulers';
|
||||||
import resetScroll from '../../../util/resetScroll';
|
|
||||||
import { useIntersectionObserver, useOnIntersect } from '../../../hooks/useIntersectionObserver';
|
import { useIntersectionObserver, useOnIntersect } from '../../../hooks/useIntersectionObserver';
|
||||||
import useOnChange from '../../../hooks/useOnChange';
|
import useOnChange from '../../../hooks/useOnChange';
|
||||||
|
|
||||||
@ -100,12 +99,8 @@ export default function useScrollHooks(
|
|||||||
isScrollPatchNeededRef.current = true;
|
isScrollPatchNeededRef.current = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Consider removing
|
|
||||||
resetScroll(containerRef.current!);
|
|
||||||
loadMoreBackwards();
|
loadMoreBackwards();
|
||||||
} else if (target.className === 'forwards-trigger') {
|
} else if (target.className === 'forwards-trigger') {
|
||||||
// TODO Consider removing
|
|
||||||
resetScroll(containerRef.current!);
|
|
||||||
loadMoreForwards();
|
loadMoreForwards();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -165,7 +165,6 @@ const InfiniteScroll: FC<OwnProps> = ({
|
|||||||
stateRef.current.currentAnchor = nextAnchor;
|
stateRef.current.currentAnchor = nextAnchor;
|
||||||
stateRef.current.currentAnchorTop = nextAnchorTop;
|
stateRef.current.currentAnchorTop = nextAnchorTop;
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
resetScroll(container);
|
|
||||||
loadMoreForwards();
|
loadMoreForwards();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,7 +185,6 @@ const InfiniteScroll: FC<OwnProps> = ({
|
|||||||
stateRef.current.currentAnchor = nextAnchor;
|
stateRef.current.currentAnchor = nextAnchor;
|
||||||
stateRef.current.currentAnchorTop = nextAnchorTop;
|
stateRef.current.currentAnchorTop = nextAnchorTop;
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
resetScroll(container);
|
|
||||||
loadMoreBackwards();
|
loadMoreBackwards();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user