Vue-formulate: Symbol as v-for key workaround options for IE11

Created on 27 Jul 2020  路  2Comments  路  Source: wearebraid/vue-formulate

Hi, thanks for the great library.

I'm going with feature request instead of bug for this because it's only an issue in IE11 which I know VueFormulate doesn't officially support. Unfortunately, we still have to support it where I work, so here goes:

The setId method sets the id to a Symbol. That's fine as it's possible to polyfill the Symbol, but the issue occurs when that symbol is fed to v-for as the key, like in FormulateGrouping. The native Symbol is a primitive, but polyfills can't add new primitives, so the implementations that I've seen tend to be returning an object with something like a _uuid key used to track it. When that object gets used as the key, Vue's of course not happy:

[Vue warn]: Avoid using non-primitive value as key, use string/number value instead.

Curious if you have any suggestions for how to get around this. One thought we have is creating our own components that override FormulateGrouping and FormulateInputGroup so we can control what gets used as the key, but that seems a bit heavy handed as there's a lot of logic in those.

bug future ready for release

Most helpful comment

Hmm. Yeah, fair points. I suppose we could just rewrite setId to use a random generated string too. Symbols are just a great "free" alternative. I'll look to make this change, thanks for the good report.

All 2 comments

Hmm. Yeah, fair points. I suppose we could just rewrite setId to use a random generated string too. Symbols are just a great "free" alternative. I'll look to make this change, thanks for the good report.

This is fixed in release/2.4.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joaquinwojcik picture joaquinwojcik  路  4Comments

titusdecali picture titusdecali  路  6Comments

mrkwdwrd picture mrkwdwrd  路  3Comments

codekiln picture codekiln  路  6Comments

yanielbf picture yanielbf  路  3Comments