@@ -31,6 +31,8 @@ export default class InstanceService
31
31
defaultLocale : 'en' ,
32
32
} ;
33
33
34
+ private rendered = false ;
35
+
34
36
constructor ( config : IConfigProps ) {
35
37
super ( ) ;
36
38
if ( config . defaultLocale ) {
@@ -59,25 +61,28 @@ export default class InstanceService
59
61
} ;
60
62
61
63
public render = ( workbench : ReactElement ) => {
62
- this . emit ( InstanceHookKind . beforeInit ) ;
63
-
64
- // get all locales including builtin and custom locales
65
- const [ languages , others ] = molecule . extension . splitLanguagesExts (
66
- this . _config . extensions
67
- ) ;
68
- this . initialLocaleService ( languages ) ;
69
-
70
- // resolve all controllers, and call `initView` to inject initial values into services
71
- Object . keys ( controllers ) . forEach ( ( key ) => {
72
- const module = controllers [ key ] ;
73
- const controller = container . resolve < Controller > ( module ) ;
74
- controller . initView ?.( ) ;
75
- } ) ;
76
-
77
- this . emit ( InstanceHookKind . beforeLoad ) ;
78
- molecule . extension . load ( others ) ;
79
-
80
- molecule . monacoService . initWorkspace ( molecule . layout . container ! ) ;
64
+ if ( ! this . rendered ) {
65
+ this . emit ( InstanceHookKind . beforeInit ) ;
66
+
67
+ // get all locales including builtin and custom locales
68
+ const [ languages , others ] = molecule . extension . splitLanguagesExts (
69
+ this . _config . extensions
70
+ ) ;
71
+ this . initialLocaleService ( languages ) ;
72
+
73
+ // resolve all controllers, and call `initView` to inject initial values into services
74
+ Object . keys ( controllers ) . forEach ( ( key ) => {
75
+ const module = controllers [ key ] ;
76
+ const controller = container . resolve < Controller > ( module ) ;
77
+ controller . initView ?.( ) ;
78
+ } ) ;
79
+
80
+ this . emit ( InstanceHookKind . beforeLoad ) ;
81
+ molecule . extension . load ( others ) ;
82
+
83
+ molecule . monacoService . initWorkspace ( molecule . layout . container ! ) ;
84
+ this . rendered = true ;
85
+ }
81
86
82
87
return workbench ;
83
88
} ;
0 commit comments