@@ -81,6 +81,7 @@ export default class CreateApp implements AppInterface {
81
81
public fiber = false
82
82
public routerMode : string
83
83
public attrs ?: Record < string , string >
84
+ public isReloading = false
84
85
85
86
constructor ( {
86
87
name,
@@ -106,6 +107,7 @@ export default class CreateApp implements AppInterface {
106
107
// exec before getInlineModeState
107
108
this . iframe = iframe ?? false
108
109
this . inline = this . getInlineModeState ( inline )
110
+ this . isReloading = false
109
111
/**
110
112
* NOTE:
111
113
* 1. Navigate after micro-app created, before mount
@@ -544,7 +546,7 @@ export default class CreateApp implements AppInterface {
544
546
if ( this . umdMode && this . container && ! destroy ) {
545
547
this . cloneContainer ( this . source . html , this . container as HTMLElement , false )
546
548
}
547
-
549
+ const shouldClearData = this . isReloading ? false : ( clearData || destroy )
548
550
/**
549
551
* this.container maybe contains micro-app element, stop sandbox should exec after cloneContainer
550
552
* NOTE:
@@ -555,7 +557,7 @@ export default class CreateApp implements AppInterface {
555
557
umdMode : this . umdMode ,
556
558
keepRouteState : keepRouteState && ! destroy ,
557
559
destroy,
558
- clearData : clearData || destroy ,
560
+ clearData : shouldClearData ,
559
561
} )
560
562
561
563
// dispatch unmount event to base app
@@ -762,7 +764,11 @@ export default class CreateApp implements AppInterface {
762
764
*/
763
765
private createSandbox ( ) : void {
764
766
if ( this . useSandbox && ! this . sandBox ) {
765
- this . sandBox = this . iframe ? new IframeSandbox ( this . name , this . url , { attrs : this . attrs } ) : new WithSandBox ( this . name , this . url )
767
+ const iframeOption = {
768
+ attrs : this . attrs ,
769
+ container : this . container
770
+ }
771
+ this . sandBox = this . iframe ? new IframeSandbox ( this . name , this . url , iframeOption ) : new WithSandBox ( this . name , this . url )
766
772
}
767
773
}
768
774
0 commit comments