-
Notifications
You must be signed in to change notification settings - Fork 35
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
[0.5.x] Async validate #69
Conversation
Hey @timacdonald , thanks for the hard work! |
It will cover all packages. Still a WIP. |
Hello, Is there any progress on this? It's been almost a month since this has been in Draft. It would be very helpful to have this feature implemented. I have an application in production that isn't working perfectly because I am waiting on this feature. Thank you. |
@djurovicigoor, still working on this, just had a few other things that were a higher priority. This one is back on my list and being pushed forward. |
packages/core/src/validator.ts
Outdated
if (isAxiosError(error) && isCancel(error)) { | ||
throw new RequestCancelled('An in-flight Precognition request was cancelled.', { cause: error }) | ||
} |
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.
Could we resolve this and then never resolve the latestPromise
instead of throwing an error?
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.
I'm wondering if this will fix #73 as well. This seems very much related.
if (touched.length === 0) { | ||
return | ||
} |
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.
This is now handled in the before
callback, which makes better sense to co-locate things.
Hi @timacdonald, I just closed my feature request #83 because it seems related. Do you know when it will be online please? |
3423e32
to
bdeb84d
Compare
nice work! i've been sitting on this PR for a while. we cannot wait to use it. our team will be leveraging that callback on our app's multistep forms! previously, we'd been 🧀 ing a timeout since the callback didn't exist yet. |
Thank you @timacdonald 🙏 |
This PR introduces the ability to respond to individual validation requests via a callback.
This is the most requested feature of Precognition.
The validate method now accepts a second parameter that can accept configuration.
This is also useful when building a wizard. You may call
validate
without any input name to and progress to the next page on success or show an alert on failure.The local configuration options will always overwrite the global configuration (or merge intelligently when applicable).