question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: support synchronous validation

See original GitHub issue

We are using yup along with react-hook-form, and almost all of our schemata support synchronous validation. Unfortunately, there’s no way to use schema.validateSync instead of schema.validate through the resolver.

While the performance impact of this is negligible, inserting an event loop between form submission and handleSubmit being called adds an unnecessary layer of complexity to our tests.

It would be great if we could pass an option to validate the schema synchronously. Better yet, if the resolver attempted to validate synchronously and fell back on asynchronous validation if required.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
jorisrecommented, Jan 22, 2021

Hi @Smona 👋🏻

FIY Yup sync validation added in the v2.0.0-beta.5 You can try it by installing yarn add @hookform/resolvers@v2.0.0-beta.5

2reactions
Smonacommented, Jan 26, 2021

@jorisre hey, awesome! Thanks for taking this on

Read more comments on GitHub >

github_iconTop Results From Across the Web

Synchronous Record Validation - Salesforce Developers
Quickly validate your payloads synchronously in development mode before you commit records to the lake. This method provides synchronous validation of object ...
Read more >
Synchronous and asynchronous input validation with ag-Grid
Synchronous validation is used for simple validation logic that is performed on the client without a remote service call. Please see the details ......
Read more >
Custom validations - Customer Fields for Developers
Here's how you add a custom validation to one of our forms: ... If your comparator is asynchronous (if it returns a Promise,)...
Read more >
Asynchronous Request-Reply pattern - Azure - Microsoft Learn
Solution · The client application makes a synchronous call to the API, triggering a long-running operation on the backend. · The API responds...
Read more >
Json schema for validation in sync function - Couchbase Forums
Can I make a feature request for a new function to be added to the sync ... This would make full validation of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found