Skip to content

Commit 46e00f1

Browse files
committed
$'syncing commit from monorepo. PR: 274, Title: FIO-9670: Fixes memory leak in angular renderer where form instances stay in memory after being destroyed'
1 parent 0f0db81 commit 46e00f1

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

projects/angular-formio/src/FormioBaseComponent.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
120120
setForm(form: FormioForm) {
121121
this.form = form;
122122
if (this.formio) {
123-
this.formio.destroy();
123+
this.formio.destroy(true);
124124
}
125125

126126
if (this.form.title) {
@@ -285,24 +285,24 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
285285
}
286286
}
287287

288-
setFormFromSrc() {
288+
setFormFromSrc() {
289289
// if a submission is provided, load it first to set required form revision.
290-
if (
291-
isEmpty(this.submission) &&
292-
this.service &&
293-
this.service.formio.submissionId
294-
) {
295-
this.service.loadSubmission().subscribe(
296-
(submission: any) => {
290+
if (
291+
isEmpty(this.submission) &&
292+
this.service &&
293+
this.service.formio.submissionId
294+
) {
295+
this.service.loadSubmission().subscribe(
296+
(submission: any) => {
297297
this.loadForm(() => {
298-
if (this.readOnly) {
299-
this.formio.options.readOnly = true;
300-
}
301-
this.submission = this.formio.submission = submission;
298+
if (this.readOnly) {
299+
this.formio.options.readOnly = true;
300+
}
301+
this.submission = this.formio.submission = submission;
302302
});
303-
},
304-
err => this.onError(err)
305-
);
303+
},
304+
err => this.onError(err)
305+
);
306306
} else {
307307
this.loadForm();
308308
}
@@ -326,7 +326,7 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
326326

327327
ngOnDestroy() {
328328
if (this.formio) {
329-
this.formio.destroy();
329+
this.formio.destroy(true);
330330
}
331331
}
332332

projects/angular-formio/src/components/formbuilder/formbuilder.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import { CustomTagsService } from '../../custom-tags.service';
2424

2525
/* tslint:disable */
2626
@Component({
27-
selector: 'form-builder',
28-
templateUrl: './formbuilder.component.html',
29-
styleUrls: ['../../../../../node_modules/@formio/js/dist/formio.builder.min.css'],
27+
selector: 'form-builder',
28+
templateUrl: './formbuilder.component.html',
29+
styleUrls: ['../../../../../node_modules/@formio/js/dist/formio.builder.min.css'],
3030
encapsulation: ViewEncapsulation.None
3131
})
3232
/* tslint:enable */
@@ -207,7 +207,7 @@ export class FormBuilderComponent implements OnInit, OnChanges, OnDestroy {
207207
}
208208

209209
if (this.formio) {
210-
this.formio.destroy();
210+
this.formio.destroy(true);
211211
}
212212
}
213213
}

0 commit comments

Comments
 (0)