Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(useForm): allow forms in production #520

Merged
merged 1 commit into from Dec 10, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -30,20 +30,8 @@ export function useLocalForm<FormShape = any>(
options: FormOptions<any>,
watch: Partial<WatchableFormValue> = {}
): [FormShape, Form | undefined] {
/**
* We're returning early here which means all the hooks called by this hook
* violate the rules of hooks. In the case of the check for
* `NODE_ENV === 'production'` this should be a non-issue because NODE_ENV
* will never change at runtime.
*/
if (process.env.NODE_ENV === 'production') {
return [options.initialValues, undefined]
}

/* eslint-disable-next-line react-hooks/rules-of-hooks */
const [values, form] = useForm<FormShape>(options, watch)

/* eslint-disable-next-line react-hooks/rules-of-hooks */
usePlugins(form)

return [values, form]
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.