formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Uncaught TypeError: Cannot add property initialized, object is not extensible

Open j-perl opened this issue 1 year ago • 1 comments

Hi,

We're currently using formiojs (4.12.1) and react-formio (4.3.0) and we're trying to update these dependencies to the latest stable versions (4.17.2 and 5.2.3 respectively at the time of this writing), however, when displaying a form, we're getting this error, which comes from this piece of code :

https://github.com/formio/formio.js/blob/22b32cfadbbb02bcdc919403951bcaecca0c2202/src/Webform.js#L339C3-L366

Apparently, modifications are made to the i18next object that is not extensible.

In strict mode, attempting to add new properties to a non-extensible object throws a TypeError.

Strangely enough, I couldn't find any thread mentioning this issue so I'm wondering whether we are not the only one having it. Do you have any idea what I could be doing wrong?

j-perl avatar Oct 16 '23 14:10 j-perl

For those having the same problem, I've found that importing and passing our own instance of i18next through the options parameter makes the problem go away.

j-perl avatar Nov 09 '23 15:11 j-perl