[Perf] TeactN: Throttle with tick end instead of RAF
This commit is contained in:
parent
3ef7136621
commit
ffa5697887
@ -5,7 +5,7 @@ import React, {
|
|||||||
import { DEBUG, DEBUG_MORE } from '../../config';
|
import { DEBUG, DEBUG_MORE } from '../../config';
|
||||||
import useForceUpdate from '../../hooks/useForceUpdate';
|
import useForceUpdate from '../../hooks/useForceUpdate';
|
||||||
import generateIdFor from '../../util/generateIdFor';
|
import generateIdFor from '../../util/generateIdFor';
|
||||||
import { throttleWithRaf } from '../../util/schedulers';
|
import { fastRaf, throttleWithTickEnd } from '../../util/schedulers';
|
||||||
import arePropsShallowEqual, { getUnequalProps } from '../../util/arePropsShallowEqual';
|
import arePropsShallowEqual, { getUnequalProps } from '../../util/arePropsShallowEqual';
|
||||||
import { orderBy } from '../../util/iteratees';
|
import { orderBy } from '../../util/iteratees';
|
||||||
import {
|
import {
|
||||||
@ -41,11 +41,11 @@ const containers = new Map<string, {
|
|||||||
DEBUG_componentName: string;
|
DEBUG_componentName: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const runCallbacksThrottled = throttleWithRaf(runCallbacks);
|
const runCallbacksThrottled = throttleWithTickEnd(runCallbacks);
|
||||||
|
|
||||||
function runCallbacks(forceOnHeavyAnimation = false) {
|
function runCallbacks(forceOnHeavyAnimation = false) {
|
||||||
if (!forceOnHeavyAnimation && isHeavyAnimating()) {
|
if (!forceOnHeavyAnimation && isHeavyAnimating()) {
|
||||||
runCallbacksThrottled();
|
fastRaf(runCallbacksThrottled);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user