react-hook-form / devtools

📋 DevTools to help debug forms.
https://react-hook-form.com/dev-tools
MIT License
638 stars 48 forks source link

devtools v4.3.1 causes error on Next.js but v4.3.0 works fine #195

Closed eunsukimme closed 1 year ago

eunsukimme commented 1 year ago

Hi 👋 I'm trying to use @hookform/devtools with my Next.js project, so I installed latest version(4.3.1). My code:

// index.tsx
// import others...
import dynamic from 'next/dynamic';
const DevTool = dynamic(() => import('@hookform/devtools').then(module => module.DevTool), {
  ssr: false,
});

export default function Page() {
  const formMethods = useForm<FormType>({ ... });
  // some business logics...

  return (
    <FormProvider {...formMethods}>
      // my form components...
      <DevTool control={formMethods.control} placement="top-right" />
    </FormProvider>
  );
};

But it causes error like this:

Screen Shot 2023-03-12 at 11 27 14 PM Screen Shot 2023-03-12 at 11 28 51 PM

Workaround

So I just downgraded to 4.3.0 and it works fine. I hope this screenshots to be useful to debug. Thanks!

bluebill1049 commented 1 year ago

which version are you using with react-hook-form?

eunsukimme commented 1 year ago

I'm using react-hook-form with version 7.40.0.

Screen Shot 2023-03-13 at 1 30 29 PM
bluebill1049 commented 1 year ago

could you try the latest?

eunsukimme commented 1 year ago

Yes! and I found that latest version(7.43.5) of react-hook-form works fine with latest version(4.3.1) of @hookform/devtools. Thanks!