From 369aa9feca32c0168d44c5deea2c9251d6513e93 Mon Sep 17 00:00:00 2001 From: brendanjbond Date: Sun, 22 Dec 2024 10:34:50 -0600 Subject: [PATCH 1/2] ensure parent references are stable before subform creation --- src/components/form/Form.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/form/Form.js b/src/components/form/Form.js index 6bd19a666a..fe0add8600 100644 --- a/src/components/form/Form.js +++ b/src/components/form/Form.js @@ -161,7 +161,11 @@ export default class FormComponent extends Component { // Make sure to not show the submit button in wizards in the nested forms. _.set(options, 'buttonSettings.showSubmit', false); - + + // Set the parent options to the subform so those references are stable when the subform is created + options.parent = this; + options.parentVisible = this.visible; + if (!this.options) { return options; } @@ -443,9 +447,7 @@ export default class FormComponent extends Component { const componentsMap = this.componentsMap; const formComponentsMap = this.subForm.componentsMap; _.assign(componentsMap, formComponentsMap); - this.component.components = this.subForm.components.map((comp) => comp.component); - this.subForm.parent = this; - this.subForm.parentVisible = this.visible; + this.component.components = this.subForm.components.map((comp) => comp.component); this.subForm.on('change', () => { if (this.subForm) { this.dataValue = this.subForm.getValue(); From 7e72629cfa3f8b6340bfdc877255c7d242cfe651 Mon Sep 17 00:00:00 2001 From: brendanjbond Date: Sun, 22 Dec 2024 10:50:31 -0600 Subject: [PATCH 2/2] update to limit change to parent option --- src/components/form/Form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/form/Form.js b/src/components/form/Form.js index fe0add8600..c682fcf69e 100644 --- a/src/components/form/Form.js +++ b/src/components/form/Form.js @@ -162,9 +162,8 @@ export default class FormComponent extends Component { // Make sure to not show the submit button in wizards in the nested forms. _.set(options, 'buttonSettings.showSubmit', false); - // Set the parent options to the subform so those references are stable when the subform is created + // Set the parent option to the subform so those references are stable when the subform is created options.parent = this; - options.parentVisible = this.visible; if (!this.options) { return options; @@ -444,6 +443,7 @@ export default class FormComponent extends Component { return (new Form(form, this.getSubOptions())).ready.then((instance) => { this.subForm = instance; this.subForm.currentForm = this; + this.subForm.parentVisible = this.visible; const componentsMap = this.componentsMap; const formComponentsMap = this.subForm.componentsMap; _.assign(componentsMap, formComponentsMap);