BearStudio / formiz

🐜 React forms with ease! Composable, headless & with built-in multi steps
https://formiz-react.com/
MIT License
390 stars 50 forks source link

React 18 asyncValidations doesn't work anymore #115

Open hugo-lovighi opened 2 years ago

hugo-lovighi commented 2 years ago

Hello ! I upgrade to react 18 and the asyncValidations rules doesn't not work anymore.

const { isValidating } = useField(props)

isValidating always return true

I try to find a solution working around react-18-upgrade-guide Promises but I dont really understand where the problem come from.

Thank you for your amazing lib !

ivan-dalmet commented 2 years ago

Hi @kesm0 We are working on the library to make sure that it will work well with the new React 18. For now, unfortunately, I don't have a quick fix. If you can provide a codesandbox with the bug we can look at it more deeply. Else we will focus on the news version for full React 18 compatibility 😊 Thanks for the feedback!

hugo-lovighi commented 2 years ago

Hello @ivan-dalmet !

I figured out that was coming from react strict mode. As mentionned in offical guide

Strict Mode has gotten stricter in React 18

Everything work as excpeted disabling it.

If anyone has the same problem, quick fix:

ivan-dalmet commented 2 years ago

Thanks a lot for the workaround! ❤️ ❤️❤️