twisty / formsy-react-components

Bootstrap components for a formsy-react form.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getId() function may bomb due to circular reference

twisty opened this issue · comments

From #31 (comment):

So in the component.js mixin there is a getId function which is trying to do a hash of stringifyed props.
this.hashString(JSON.stringify(this.props)
The props has a circular structure so cannot be stringifyed when we pass in a node. By just supplying an ID props the function wont run this code and I can use a node. Wondering if we need to make some changes to not call stringify on the props.

Here is the function: https://github.com/twisty/formsy-react-components/blob/master/src/mixins/component.js#L33-L35

Need to tweak the strategy for generating the ID.

Changed to make the ID based on the name of the element, and a hash of the label.