Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIO-9480: ensure parent references are stable before subform creation #5954

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/form/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ 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 option to the subform so those references are stable when the subform is created
options.parent = this;

if (!this.options) {
return options;
}
Expand Down Expand Up @@ -440,12 +443,11 @@ 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);
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();
Expand Down
Loading