Profile: Fix skipped animation on fast touchpads (#6454)

This commit is contained in:
zubiden 2025-11-11 14:37:31 +01:00 committed by Alexander Zinchuk
parent 5847fa606d
commit 6b12b40aa4

View File

@ -2,6 +2,7 @@ import { type ElementRef, useEffect, useRef, useSignal } from '@teact';
import { requestMutation } from '../../lib/fasterdom/fasterdom';
import stopEvent from '../../util/stopEvent';
import useEffectWithPrevDeps from '../useEffectWithPrevDeps';
import useLastCallback from '../useLastCallback';
type State = 'overscroll' | 'animating' | 'normal';
@ -205,7 +206,8 @@ export default function useTopOverscroll({
};
}, [containerRef, isDisabled, getState]);
useEffect(() => {
useEffectWithPrevDeps(([prevIsOverscrolled]) => {
if (prevIsOverscrolled === isOverscrolled) return;
if (!isOverscrolled && getState() === 'animating') {
return; // We're animating towards this state
}