-
Notifications
You must be signed in to change notification settings - Fork 107
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
Update submission.ts #757
Update submission.ts #757
Conversation
|
commit: @conform-to/dom
@conform-to/react
@conform-to/validitystate
@conform-to/yup
@conform-to/zod
|
const extraError = | ||
'formErrors' in options || 'fieldErrors' in options | ||
? normalize<Record<string, FormError | null>>({ | ||
'': options.formErrors ?? null, | ||
...options.fieldErrors, | ||
}) | ||
: null; | ||
const error = | ||
context.error || extraError | ||
? { | ||
...context.error, | ||
...extraError, | ||
} | ||
: undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@edmundhung I'm not sure if it makes sense to show the error status, but I kept it in because I'm not sure what the expectations are
@edmundhung I can fix tests if you think this is an appropriate change |
nevermind, I figured out how to do it. this is the code that works with useEffect(() => {
if (
fetcher.state === "idle" &&
fetcher.data &&
fetcher.data.status !== "error"
) {
onFinish();
}
}, [fetcher.data, fetcher.state, onFinish]); where |
fixes: #756