Formik: Warnings from Draft.js (Immutable.js) with Formik 1.3.0 (iterable.length has been deprecated)

Created on 13 Sep 2018  路  7Comments  路  Source: formium/formik

Current Behavior


When using formik 1.3.0 and draft.js, I'm getting hundreds of warnings thrown by immutable, when trying to type in the RichEditorExample component. The warnings say: iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. This is only happening when I'm calling setFieldValue, from draft.js, using a lodash-like path syntax field, to modify a value that's nested more than one-level deep.

Steps to Reproduce


See example attached (cloned from: https://github.com/jaredpalmer/formik/issues/93). All that I did was upgrade to formik 1.3.0 and make the initial structure nested.
The draft.js component is now using the updated path: editorState.edit instead of editorState.

Expected behavior


No Errors thrown

Suggested solution(s)

I was able to track this bug down to lodash.cloneDeep. Since Draft.js uses Immutable.js, we shouldn't be using lodash. Short of bringing in Immutable to deep clone this structure, are there any lightweight alternatives?

Additional context

CodeSandbox Link:

https://codesandbox.io/embed/v4vo4yny5

  • Formik Version: 1.3.0
  • React Version: 15.3.0
  • TypeScript Version: n/a
  • Browser and Version: Chrome 69
  • OS: MacOS High Sierra
  • Node Version: v10.4.1
  • Package Manager and Version: npm v6.1.0
stale

Most helpful comment

please open this issue.
This issue is still ongoing and it is very annoying.

All 7 comments

Bump: Just wanted to see if anyone has thought about this. I'd love to bounce ideas off of people!

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

ProBot automatically closed this due to inactivity. Holler if this is a mistake, and we'll re-open it.

please open this issue.
This issue is still ongoing and it is very annoying.

I'm also having this problem with Formik 1.4.2 and Draft 0.10.5. My use case includes having a FieldArray of Draft editors.

The performance of my form makes it unusable so it'd be nice to get this issue reopened.

Does anyone know if this issue also exists for Slate?

I managed to stop the warnings by following the steps here: https://github.com/facebook/draft-js/issues/950#issuecomment-381911759

I hope it works for you too!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sibelius picture sibelius  路  3Comments

giulioambrogi picture giulioambrogi  路  3Comments

emartini picture emartini  路  3Comments

dearcodes picture dearcodes  路  3Comments

pmonty picture pmonty  路  3Comments