Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(values: Values = state.values) => {
return unstable_runWithPriority(LowPriority, () => {
return runAllValidations(values)
.then(combinedErrors => {
if (!!isMounted.current) {
dispatch({ type: 'SET_ERRORS', payload: combinedErrors });
}
return combinedErrors;
})
.catch(actualException => {
if (process.env.NODE_ENV !== 'production') {
// Users can throw during validate, however they have no way of handling their error on touch / blur. In low priority, we need to handle it
console.warn(
`Warning: An unhandled error was caught during low priority validation in `,
actualException
);
}
});
): void {
// TODO: This function shares a lot of logic with attemptToDispatchEvent.
// Try to unify them. It's a bit tricky since it would require two return
// values.
let targetInst = getClosestInstanceFromNode(queuedTarget.target);
if (targetInst !== null) {
let nearestMounted = getNearestMountedFiber(targetInst);
if (nearestMounted !== null) {
const tag = nearestMounted.tag;
if (tag === SuspenseComponent) {
let instance = getSuspenseInstanceFromFiber(nearestMounted);
if (instance !== null) {
// We're blocked on hydrating this boundary.
// Increase its priority.
queuedTarget.blockedOn = instance;
runWithPriority(queuedTarget.priority, () => {
attemptHydrationAtCurrentPriority(nearestMounted);
});
return;
}
} else if (tag === HostRoot) {
const root: FiberRoot = nearestMounted.stateNode;
if (root.hydrate) {
queuedTarget.blockedOn = getContainerFromFiber(nearestMounted);
// We don't currently have a way to increase the priority of
// a root other than sync.
return;
}
}
}
}
queuedTarget.blockedOn = null;
(action: Action) => {
// Run the first update at "user-blocking" priority in case dispatch is called from a non-React event.
// In this case, the current (and "next") priorities would both be "normal",
// and suspense would potentially block both updates.
runWithPriority(UserBlockingPriority, () => dispatch(action));
next(() => dispatch({type: 'UPDATE_INSPECTED_ELEMENT_ID'}));
},
[dispatch],
if (change) setTimeout(() => run(low, () => set(Math.round(Math.random() * 0xffffff))), Math.random() * 1000)
}, [change])
_prerenderOverscanRows = () => {
this._prerenderOverscanRowsTimeoutID = null;
runWithPriority(IdlePriority, () => {
this.setState(prevState => {
const {
itemCount,
maxNumPrerenderRows = DEFAULT_MAX_NUM_PRERENDER_ROWS,
} = this.props;
const [startIndex, stopIndex] = this._getVisibleIndicesForOffset(
prevState.scrollTop
);
const numRowsPerViewport = stopIndex - startIndex;
const numPrerenderRows = Math.min(
numRowsPerViewport,
maxNumPrerenderRows
);
const startSequence = useCallback(() => {
setDefaultPriority(true);
runWithPriority(LowPriority, () => setLowPriority(true));
runWithPriority(IdlePriority, () => setIdlePriority(true));
}, []);
function sendDeferredAnalyticsPing(value) {
unstable_runWithPriority(unstable_LowPriority, function() {
unstable_scheduleCallback(function() {
sendAnalyticsPing(value);
});
});
}
(a: string) => {
if (queryText !== a) {
unstable_runWithPriority(unstable_IdlePriority, () => setQuery(a))
}
},
[setQuery, queryText]
const startSequence = useCallback(() => {
setDefaultPriority(true);
runWithPriority(LowPriority, () => setLowPriority(true));
runWithPriority(IdlePriority, () => setIdlePriority(true));
}, []);