From 6ccd0ef8d157f1d7d1159c65aa8011f9ce494328 Mon Sep 17 00:00:00 2001 From: helious Date: Wed, 22 Apr 2020 19:14:49 -0400 Subject: [PATCH] Correct import of LowPriority from scheduler --- packages/formik/src/Formik.tsx | 10 ++++++---- packages/formik/test/Formik.test.tsx | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/formik/src/Formik.tsx b/packages/formik/src/Formik.tsx index 252a3cc00..01e8e1246 100755 --- a/packages/formik/src/Formik.tsx +++ b/packages/formik/src/Formik.tsx @@ -27,7 +27,7 @@ import { } from './utils'; import { FormikProvider } from './FormikContext'; import invariant from 'tiny-warning'; -import { LowPriority, unstable_runWithPriority } from 'scheduler'; +import { unstable_LowPriority, unstable_runWithPriority } from 'scheduler'; type FormikMessage = | { type: 'SUBMIT_ATTEMPT' } @@ -326,7 +326,7 @@ export function useFormik({ // form is valid before executing props.onSubmit. const validateFormWithLowPriority = useEventCallback( (values: Values = state.values) => { - return unstable_runWithPriority(LowPriority, () => { + return unstable_runWithPriority(unstable_LowPriority, () => { return runAllValidations(values) .then(combinedErrors => { if (!!isMounted.current) { @@ -889,8 +889,10 @@ export function useFormik({ const getFieldHelpers = React.useCallback( (name: string): FieldHelperProps => { return { - setValue: (value: any, shouldValidate?: boolean) => setFieldValue(name, value, shouldValidate), - setTouched: (value: boolean, shouldValidate?: boolean) => setFieldTouched(name, value, shouldValidate), + setValue: (value: any, shouldValidate?: boolean) => + setFieldValue(name, value, shouldValidate), + setTouched: (value: boolean, shouldValidate?: boolean) => + setFieldTouched(name, value, shouldValidate), setError: (value: any) => setFieldError(name, value), }; }, diff --git a/packages/formik/test/Formik.test.tsx b/packages/formik/test/Formik.test.tsx index 9e557fff0..481e537de 100644 --- a/packages/formik/test/Formik.test.tsx +++ b/packages/formik/test/Formik.test.tsx @@ -975,8 +975,8 @@ describe('', () => { content: [ ['a1', 'a2'], ['b1', 'b2'], - ] - } + ], + }; const dataForValidation = prepareDataForValidation(expected); expect(dataForValidation).toEqual(expected);