File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,12 @@ export default class FormGenerator extends React.Component {
1616 // Intiate the form property
1717 this . form = null
1818 }
19+ componentDidMount ( ) {
20+ this . props . onMount ( this . form )
21+ }
22+ componentDidUpdate ( ) {
23+ this . props . onMount ( this . form )
24+ }
1925 shouldComponentUpdate ( nextProps ) {
2026 // Only Re-renders for changes in field config
2127 if ( nextProps . fieldConfig !== this . props . fieldConfig ) {
@@ -99,10 +105,9 @@ export default class FormGenerator extends React.Component {
99105 generateFields ( ) {
100106 // Reset the form instance
101107 this . form = null
102- const { fieldConfig, onMount } = this . props
108+ const { fieldConfig } = this . props
103109 if ( fieldConfig . controls ) {
104- const fields = this . setControl ( fieldConfig , 'my_form' )
105- onMount ( this . form )
110+ const fields = this . setControl ( fieldConfig , `my_form${ new Date ( ) . getTime ( ) } ` )
106111 return fields
107112 } else {
108113 // Throw error
You can’t perform that action at this time.
0 commit comments