5
5
resolveModule ,
6
6
} from '@codesandbox/common/lib/sandbox/modules' ;
7
7
import getTemplate from '@codesandbox/common/lib/templates' ;
8
- import { ServerExecutor , IExecutor } from '@codesandbox/executors' ;
9
8
import { parseSandboxConfigurations } from '@codesandbox/common/lib/templates/configuration/parse-sandbox-configurations' ;
10
9
import { getPreviewTabs } from '@codesandbox/common/lib/templates/devtools' ;
11
10
import {
@@ -35,7 +34,6 @@ import { CorrectionClearAction } from 'codesandbox-api/dist/types/actions/correc
35
34
import * as React from 'react' ;
36
35
37
36
// borrow the menu icon from Header in case header is not shown
38
- import { dispatch } from 'codesandbox-api' ;
39
37
import { MenuIcon } from '../legacy/Header/elements' ;
40
38
import SplitPane from '../SplitPane' ;
41
39
import { CodeEditor } from './CodeEditor' ;
@@ -86,11 +84,6 @@ type State = {
86
84
// eslint-disable-next-line import/no-default-export
87
85
export default class Content extends React . PureComponent < Props , State > {
88
86
state : State ;
89
- executor : IExecutor ;
90
- errors : ModuleError [ ] ;
91
- corrections : ModuleCorrection [ ] ;
92
- editor ?: Editor ;
93
- preview ?: BasePreview ;
94
87
95
88
constructor ( props : Props ) {
96
89
super ( props ) ;
@@ -111,32 +104,8 @@ export default class Content extends React.PureComponent<Props, State> {
111
104
112
105
this . errors = [ ] ;
113
106
this . corrections = [ ] ;
114
-
115
- this . executor = new ServerExecutor ( ) ;
116
- this . initializeExecutor ( ) ;
117
107
}
118
108
119
- /**
120
- * Initialize the interface responsible for talking with the server, managing
121
- * the terminal output
122
- */
123
- initializeExecutor = async ( ) => {
124
- const templateDefinition = getTemplate ( this . props . sandbox . template ) ;
125
- if ( templateDefinition . isServer ) {
126
- await this . executor . initialize ( {
127
- host : 'https://codesandbox.io' ,
128
- files : { } ,
129
- sandboxId : this . props . sandbox . id ,
130
- } ) ;
131
-
132
- await this . executor . setup ( ) ;
133
-
134
- this . executor . on ( 'sandbox:log' , message => {
135
- dispatch ( { type : 'terminal:message' , data : message . data } ) ;
136
- } ) ;
137
- }
138
- } ;
139
-
140
109
setPane = ( pos : DevToolsTabPosition ) => {
141
110
this . setState ( { currentDevToolPosition : pos } ) ;
142
111
} ;
@@ -194,6 +163,11 @@ export default class Content extends React.PureComponent<Props, State> {
194
163
return < StyledNotSyncedIcon show = { undefined } /> ;
195
164
} ;
196
165
166
+ errors : ModuleError [ ] ;
167
+ corrections : ModuleCorrection [ ] ;
168
+ editor ?: Editor ;
169
+ preview ?: BasePreview ;
170
+
197
171
UNSAFE_componentWillReceiveProps ( nextProps : Props ) {
198
172
if ( this . props . currentModule !== nextProps . currentModule ) {
199
173
if ( ! this . state . tabs . some ( x => x . id === nextProps . currentModule . id ) ) {
@@ -215,18 +189,13 @@ export default class Content extends React.PureComponent<Props, State> {
215
189
this . setState ( {
216
190
tabs : this . getInitTabs ( nextProps ) ,
217
191
} ) ;
218
- this . initializeExecutor ( ) ;
219
192
}
220
193
}
221
194
222
195
componentDidMount ( ) {
223
196
setTimeout ( this . handleResize ) ;
224
197
}
225
198
226
- componentWillUnmount ( ) {
227
- this . executor . dispose ( ) ;
228
- }
229
-
230
199
setProjectView = ( id : string | undefined , view : boolean ) => {
231
200
this . setState ( { isInProjectView : view } ) ;
232
201
} ;
0 commit comments