Navigation Menu

Skip to content

Commit

Permalink
Correct import of LowPriority from scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
helious committed Apr 22, 2020
1 parent 4b6731f commit 6ccd0ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions packages/formik/src/Formik.tsx
Expand Up @@ -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<Values> =
| { type: 'SUBMIT_ATTEMPT' }
Expand Down Expand Up @@ -326,7 +326,7 @@ export function useFormik<Values extends FormikValues = FormikValues>({
// 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) {
Expand Down Expand Up @@ -889,8 +889,10 @@ export function useFormik<Values extends FormikValues = FormikValues>({
const getFieldHelpers = React.useCallback(
(name: string): FieldHelperProps<any> => {
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),
};
},
Expand Down
4 changes: 2 additions & 2 deletions packages/formik/test/Formik.test.tsx
Expand Up @@ -975,8 +975,8 @@ describe('<Formik>', () => {
content: [
['a1', 'a2'],
['b1', 'b2'],
]
}
],
};

const dataForValidation = prepareDataForValidation(expected);
expect(dataForValidation).toEqual(expected);
Expand Down

0 comments on commit 6ccd0ef

Please sign in to comment.