resolvers icon indicating copy to clipboard operation
resolvers copied to clipboard

Error when Trying to Use Arktype Resolver

Open lucaschultz opened this issue 1 year ago • 2 comments
trafficstars

Describe the bug When trying to use the arktypeResolver the following error happens:

Error: Tried to initialize an $ark registry but one already existed. This probably means you are either depending on multiple versions of an arktype package, or importing the same package from both ESM and CJS. Review package.json versions across your repo to ensure consistency.

To Reproduce Steps to reproduce the behavior:

  1. Call the useForm hook with the arktypeResolver as resolver.

Codesandbox link (Required) No Codesandbox link, but I created a minimal reproduction using Next.js here, but the error happened in a Vite/React app I'm working on. @ssalbdivad you might wanna have a look 😊

Expected behavior Being able to use the provider, regardless if the project is ESM or not.

Screenshots

Bildschirmfoto 2024-06-18 um 12 28 05

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
  • Version: 125.0.6422.114

lucaschultz avatar Jun 18 '24 10:06 lucaschultz

Thanks for letting me know! This issue should be opened in the ArkType repo instead.

Happy to investigate what might be going wrong there!

ssalbdivad avatar Jun 18 '24 13:06 ssalbdivad

This issue should be opened in the ArkType repo instead.

@ssalbdivad ah yes, I was wondering where to open the issue. Settled on this repository because the error message lead to be believe the issue might be that using the resolver creates another registry which somehow collides with the other one, so I assumed the problem might be one of the resolver rather than with Arktype itself.

Should I open a copy in the Arktype repo?

lucaschultz avatar Jun 19 '24 19:06 lucaschultz

~~Closing in favor fo https://github.com/arktypeio/arktype/issues/1022~~

jorisre avatar Jul 02 '24 20:07 jorisre

I made some changes to improve bundle size in #699. Hopefully, it will fix this issue in the next release.

jorisre avatar Jul 02 '24 20:07 jorisre

@lucaschultz Can you try with the last version (3.8.0)?

jorisre avatar Jul 05 '24 10:07 jorisre

I looked at the example you provided to reproduce the issue in Next.js and updated the @hookform/resolvers package to its latest version (3.9.0). The problem is now fixed. Thank you for reporting the issue. I'm closing this issue since it's been resolved.

jorisre avatar Jul 06 '24 04:07 jorisre