Error after placing DevTools component in React TS

Open
#199 5 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript
Domain
devtools, frontend

Research direction

Start by reproducing the error with the shown useForm setup and usage, then inspect the reset and subscription calls named in index.tsx and the stack traces from index.esm.mjs and index.cjs.development.js. Done means DevTools can remain mounted without the updateFormState exception or the unmounted-component warning.

Written by the indexing model from the issue text.

Description


  const form = useForm({
    resolver: yupResolver(Yup.object(filterSchema).required()),
    defaultValues: filter,
  });
  const {
    register,
    handleSubmit,
    reset,
    getValues,
    watch,
    setValue,
    setFocus,
    control,
  } = form;

  return (
       <>
            <FormContainer>
                <DevTool control={control} />
           </FormContainer>
      </>
  );


This is my code. I am trying to use DevTools but it is throwing this error

index.cjs.development.js:194 Uncaught TypeError: updateFormState is not a function
at shouldRenderFormState (index.cjs.development.js:194:1)
at Object.next (index.cjs.development.js:278:1)
at Object.next (index.esm.mjs:873:1)
at reset (index.esm.mjs:2062:1)
at index.tsx:141:5
at invokePassiveEffectCreate (react-dom.development.js:23487:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
at invokeGuardedCallback (react-dom.development.js:4056:1)
at flushPassiveEffectsImpl

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

If I remove the DevTools component, then it runs fine. Can someone please help me..

Dominant language
TypeScript
Stars
670
Forks
55
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-hook-form/devtools

All issues in react-hook-form/devtools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.