Remove redundant freezes
This commit is contained in:
parent
9b841a5f31
commit
fa08832fca
@ -162,7 +162,6 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
const [hasFocusing, setHasFocusing] = useState<boolean>(Boolean(focusingId));
|
||||
|
||||
const areMessagesLoaded = Boolean(messageIds);
|
||||
const isFocusing = Boolean(focusingId);
|
||||
|
||||
useOnChange(() => {
|
||||
// We only need it first time when message list appears
|
||||
@ -183,7 +182,7 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
}, [firstUnreadId]);
|
||||
|
||||
const {
|
||||
observe: observeIntersectionForMedia, freeze: freezeForMedia, unfreeze: unfreezeForMedia,
|
||||
observe: observeIntersectionForMedia,
|
||||
} = useIntersectionObserver({
|
||||
rootRef: containerRef,
|
||||
throttleMs: INTERSECTION_THROTTLE_FOR_MEDIA,
|
||||
@ -236,16 +235,6 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
memoFocusingIdRef.current = focusingId;
|
||||
}, [focusingId]);
|
||||
|
||||
useOnChange(() => {
|
||||
if (isFocusing) {
|
||||
freezeForMedia();
|
||||
freezeForReading();
|
||||
} else {
|
||||
unfreezeForReading();
|
||||
unfreezeForMedia();
|
||||
}
|
||||
}, [isFocusing]);
|
||||
|
||||
const { observe: observeIntersectionForAnimatedStickers } = useIntersectionObserver({
|
||||
rootRef: containerRef,
|
||||
throttleMs: INTERSECTION_THROTTLE_FOR_MEDIA,
|
||||
@ -545,7 +534,6 @@ const MessageList: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
containerRef={containerRef}
|
||||
className="messages-container"
|
||||
messageIds={messageIds || [lastMessage!.id]}
|
||||
isFocusing={isFocusing}
|
||||
loadMoreForwards={loadMoreForwards}
|
||||
loadMoreBackwards={loadMoreBackwards}
|
||||
isViewportNewest={isViewportNewest}
|
||||
|
||||
@ -10,7 +10,6 @@ type OwnProps = {
|
||||
containerRef: MutableRefObject<HTMLDivElement | null>;
|
||||
className: string;
|
||||
messageIds: number[];
|
||||
isFocusing: boolean;
|
||||
loadMoreForwards?: NoneToVoidFunction;
|
||||
loadMoreBackwards?: NoneToVoidFunction;
|
||||
isViewportNewest?: boolean;
|
||||
@ -27,7 +26,6 @@ const MessageScroll: FC<OwnProps> = ({
|
||||
containerRef,
|
||||
className,
|
||||
messageIds,
|
||||
isFocusing,
|
||||
loadMoreForwards,
|
||||
loadMoreBackwards,
|
||||
isViewportNewest,
|
||||
@ -67,8 +65,6 @@ const MessageScroll: FC<OwnProps> = ({
|
||||
|
||||
const {
|
||||
observe: observeIntersection,
|
||||
freeze: freezeForLoadMore,
|
||||
unfreeze: unfreezeForLoadMore,
|
||||
} = useIntersectionObserver({
|
||||
rootRef: containerRef,
|
||||
margin: MESSAGE_LIST_SENSITIVE_AREA,
|
||||
@ -117,14 +113,6 @@ const MessageScroll: FC<OwnProps> = ({
|
||||
|
||||
useOnIntersect(fabTriggerRef, observeIntersectionForNotch);
|
||||
|
||||
useOnChange(() => {
|
||||
if (isFocusing) {
|
||||
freezeForLoadMore();
|
||||
} else {
|
||||
unfreezeForLoadMore();
|
||||
}
|
||||
}, [isFocusing]);
|
||||
|
||||
// Workaround for FAB and notch flickering with tall incoming message
|
||||
useOnChange(() => {
|
||||
freezeForFab();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user