From 49673e4b0b43a1a2c808d86be8e5080dcfc57596 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 28 Sep 2021 15:42:39 +0300 Subject: [PATCH] [Refactoring] Rename `isAutoUnfreezeDisabled` -> `noAutoFreeze` (#1472) --- src/components/middle/hooks/useMessageObservers.ts | 2 +- src/hooks/useIntersectionObserver.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/middle/hooks/useMessageObservers.ts b/src/components/middle/hooks/useMessageObservers.ts index 06ca65d2..43e8b37f 100644 --- a/src/components/middle/hooks/useMessageObservers.ts +++ b/src/components/middle/hooks/useMessageObservers.ts @@ -31,7 +31,7 @@ export default function useMessageObservers( } = useIntersectionObserver({ rootRef: containerRef, throttleMs: INTERSECTION_THROTTLE_FOR_READING, - isAutoUnfreezeDisabled: true, + noAutoFreeze: true, }, (entries) => { if (type !== 'thread') { return; diff --git a/src/hooks/useIntersectionObserver.ts b/src/hooks/useIntersectionObserver.ts index 9924ef96..2900b9bd 100644 --- a/src/hooks/useIntersectionObserver.ts +++ b/src/hooks/useIntersectionObserver.ts @@ -32,7 +32,7 @@ export function useIntersectionObserver({ margin, threshold, isDisabled, - isAutoUnfreezeDisabled = false, + noAutoFreeze = false, }: { rootRef: RefObject; throttleMs?: number; @@ -41,7 +41,7 @@ export function useIntersectionObserver({ margin?: number; threshold?: number | number[]; isDisabled?: boolean; - isAutoUnfreezeDisabled?: boolean; + noAutoFreeze?: boolean; }, rootCallback?: RootCallback): Response { const controllerRef = useRef(); const rootCallbackRef = useRef(); @@ -67,7 +67,7 @@ export function useIntersectionObserver({ const freeze = useCallback(() => { freezeFlagsRef.current++; - if (isAutoUnfreezeDisabled) { + if (noAutoFreeze) { return; } @@ -87,7 +87,7 @@ export function useIntersectionObserver({ freezeFlagsRef.current = 1; unfreeze(); }, AUTO_UNFREEZE_TIMEOUT); - }, [isAutoUnfreezeDisabled, unfreeze]); + }, [noAutoFreeze, unfreeze]); useHeavyAnimationCheck(freeze, unfreeze);