formik-antd icon indicating copy to clipboard operation
formik-antd copied to clipboard

Memory leak using Select

Open JoFont opened this issue 3 years ago • 2 comments

Using any combination of the Select field from "formik-ant" results in a memory leak of some sorts. The select dropdown never opens and the app crashes. Using the SelectInput directly from Ant Design outside of a FormItem works fine but defeats the purpose of using this library.

<FormItem name="title" label="Title" className="col-span-2 md:col-span-1">
  <Select name="title" options={options} />
</FormItem>

Notes:

  • I'm using React concurrent mode.
  • Setting options declaratively produces the same error.
  • After some inspection on the crashed app, the only error I can see is a violation warning as seen below. 826d5d579ace8a60b33b5c63a22f105f

Thank you for your help.

JoFont avatar Jan 31 '21 16:01 JoFont

Follow up on this issue: downgrading Ant Design version to 4.1.0 from 4.11.2 seemed to work.

JoFont avatar Feb 01 '21 21:02 JoFont

2022 update: I managed to resolve this by updating formik-antd and antd to their latest versions (2.0.4 and 4.22.6 respectively). Furthermore you need to check which version of React you are running. Some changes were made to React-DOM in React 18.1 that may cause some incompatibilities between React <> Formik-antd <> antd .

I first tried to downgrade antd, but this causes issues with React 18.

misterrPink1 avatar Aug 17 '22 17:08 misterrPink1