55 resolveModule ,
66} from '@codesandbox/common/lib/sandbox/modules' ;
77import getTemplate from '@codesandbox/common/lib/templates' ;
8- import { ServerExecutor , IExecutor } from '@codesandbox/executors' ;
98import { parseSandboxConfigurations } from '@codesandbox/common/lib/templates/configuration/parse-sandbox-configurations' ;
109import { getPreviewTabs } from '@codesandbox/common/lib/templates/devtools' ;
1110import {
@@ -35,7 +34,6 @@ import { CorrectionClearAction } from 'codesandbox-api/dist/types/actions/correc
3534import * as React from 'react' ;
3635
3736// borrow the menu icon from Header in case header is not shown
38- import { dispatch } from 'codesandbox-api' ;
3937import { MenuIcon } from '../legacy/Header/elements' ;
4038import SplitPane from '../SplitPane' ;
4139import { CodeEditor } from './CodeEditor' ;
@@ -86,11 +84,6 @@ type State = {
8684// eslint-disable-next-line import/no-default-export
8785export default class Content extends React . PureComponent < Props , State > {
8886 state : State ;
89- executor : IExecutor ;
90- errors : ModuleError [ ] ;
91- corrections : ModuleCorrection [ ] ;
92- editor ?: Editor ;
93- preview ?: BasePreview ;
9487
9588 constructor ( props : Props ) {
9689 super ( props ) ;
@@ -111,32 +104,8 @@ export default class Content extends React.PureComponent<Props, State> {
111104
112105 this . errors = [ ] ;
113106 this . corrections = [ ] ;
114-
115- this . executor = new ServerExecutor ( ) ;
116- this . initializeExecutor ( ) ;
117107 }
118108
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-
140109 setPane = ( pos : DevToolsTabPosition ) => {
141110 this . setState ( { currentDevToolPosition : pos } ) ;
142111 } ;
@@ -194,6 +163,11 @@ export default class Content extends React.PureComponent<Props, State> {
194163 return < StyledNotSyncedIcon show = { undefined } /> ;
195164 } ;
196165
166+ errors : ModuleError [ ] ;
167+ corrections : ModuleCorrection [ ] ;
168+ editor ?: Editor ;
169+ preview ?: BasePreview ;
170+
197171 UNSAFE_componentWillReceiveProps ( nextProps : Props ) {
198172 if ( this . props . currentModule !== nextProps . currentModule ) {
199173 if ( ! this . state . tabs . some ( x => x . id === nextProps . currentModule . id ) ) {
@@ -215,18 +189,13 @@ export default class Content extends React.PureComponent<Props, State> {
215189 this . setState ( {
216190 tabs : this . getInitTabs ( nextProps ) ,
217191 } ) ;
218- this . initializeExecutor ( ) ;
219192 }
220193 }
221194
222195 componentDidMount ( ) {
223196 setTimeout ( this . handleResize ) ;
224197 }
225198
226- componentWillUnmount ( ) {
227- this . executor . dispose ( ) ;
228- }
229-
230199 setProjectView = ( id : string | undefined , view : boolean ) => {
231200 this . setState ( { isInProjectView : view } ) ;
232201 } ;
0 commit comments