@@ -9,7 +9,10 @@ import {Form, Utils, Webform} from '@formio/js';
99import { AlertsPosition } from './types/alerts-position' ;
1010const { Evaluator, fastCloneDeep } = Utils ;
1111
12- @Component ( { template : '' } )
12+ @Component ( {
13+ template : '' ,
14+ standalone : false
15+ } )
1316export class FormioBaseComponent implements OnInit , OnChanges , OnDestroy {
1417 @Input ( ) form ?: FormioForm ;
1518 @Input ( ) submission ?: any = { } ;
@@ -286,38 +289,29 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
286289 }
287290
288291 setFormFromSrc ( ) {
289- // if a submission is provided, load it first to set required form revision.
292+ this . service . loadForm ( { params : { live : 1 } } ) . subscribe (
293+ ( form : FormioForm ) => {
294+ if ( form && form . components ) {
295+ this . ngZone . runOutsideAngular ( ( ) => {
296+ this . setForm ( form ) ;
297+ } ) ;
298+ }
299+
300+ // if a submission is also provided.
290301 if (
291302 isEmpty ( this . submission ) &&
292303 this . service &&
293304 this . service . formio . submissionId
294305 ) {
295306 this . service . loadSubmission ( ) . subscribe (
296307 ( submission : any ) => {
297- this . loadForm ( ( ) => {
298308 if ( this . readOnly ) {
299309 this . formio . options . readOnly = true ;
300310 }
301311 this . submission = this . formio . submission = submission ;
302- } ) ;
303312 } ,
304313 err => this . onError ( err )
305314 ) ;
306- } else {
307- this . loadForm ( ) ;
308- }
309- }
310-
311- loadForm ( done ?: ( ) => void ) {
312- this . service . loadForm ( { params : { live : 1 } } ) . subscribe (
313- ( form : FormioForm ) => {
314- if ( form && form . components ) {
315- this . ngZone . runOutsideAngular ( ( ) => {
316- this . setForm ( form ) ;
317- } ) ;
318- }
319- if ( done ) {
320- done ( ) ;
321315 }
322316 } ,
323317 err => this . onError ( err )
@@ -514,7 +508,7 @@ export class FormioBaseComponent implements OnInit, OnChanges, OnDestroy {
514508 . saveSubmission ( submission )
515509 . subscribe (
516510 ( sub : { } ) => this . onSubmit ( sub , true ) ,
517- err => this . onError ( ( err ?. error || err ) )
511+ err => this . onError ( err )
518512 ) ;
519513 } else {
520514 this . onSubmit ( submission , false ) ;
0 commit comments