From ffa569788737009ee56f8052f85bbbd903a8cead Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 31 Dec 2021 18:17:30 +0100 Subject: [PATCH] [Perf] TeactN: Throttle with tick end instead of RAF --- src/lib/teact/teactn.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/teact/teactn.tsx b/src/lib/teact/teactn.tsx index bf7248231..58cfc5643 100644 --- a/src/lib/teact/teactn.tsx +++ b/src/lib/teact/teactn.tsx @@ -5,7 +5,7 @@ import React, { import { DEBUG, DEBUG_MORE } from '../../config'; import useForceUpdate from '../../hooks/useForceUpdate'; import generateIdFor from '../../util/generateIdFor'; -import { throttleWithRaf } from '../../util/schedulers'; +import { fastRaf, throttleWithTickEnd } from '../../util/schedulers'; import arePropsShallowEqual, { getUnequalProps } from '../../util/arePropsShallowEqual'; import { orderBy } from '../../util/iteratees'; import { @@ -41,11 +41,11 @@ const containers = new Map(); -const runCallbacksThrottled = throttleWithRaf(runCallbacks); +const runCallbacksThrottled = throttleWithTickEnd(runCallbacks); function runCallbacks(forceOnHeavyAnimation = false) { if (!forceOnHeavyAnimation && isHeavyAnimating()) { - runCallbacksThrottled(); + fastRaf(runCallbacksThrottled); return; }