File tree 3 files changed +36
-23
lines changed
packages/app/src/app/overmind 3 files changed +36
-23
lines changed Original file line number Diff line number Diff line change @@ -261,26 +261,7 @@ export const setCurrentSandbox: AsyncAction<Sandbox> = async (
261
261
state . workspace . project . description = sandbox . description || '' ;
262
262
state . workspace . project . alias = sandbox . alias || '' ;
263
263
264
- await effects . executor . initializeExecutor ( sandbox ) ;
265
-
266
- [
267
- 'connect' ,
268
- 'disconnect' ,
269
- 'sandbox:status' ,
270
- 'sandbox:start' ,
271
- 'sandbox:stop' ,
272
- 'sandbox:error' ,
273
- 'sandbox:log' ,
274
- 'sandbox:hibernate' ,
275
- 'sandbox:update' ,
276
- 'sandbox:port' ,
277
- 'shell:out' ,
278
- 'shell:exit' ,
279
- ] . forEach ( message => {
280
- effects . executor . listen ( message , actions . server . onSSEMessage ) ;
281
- } ) ;
282
-
283
- effects . executor . setupExecutor ( ) ;
264
+ actions . server . startContainer ( sandbox ) ;
284
265
} ;
285
266
286
267
export const updateCurrentSandbox : AsyncAction < Sandbox > = async (
Original file line number Diff line number Diff line change @@ -360,6 +360,11 @@ export const forkSandbox: AsyncAction<{
360
360
) ;
361
361
effects . preview . updateAddressbarUrl ( ) ;
362
362
363
+ if ( templateDefinition . isServer ) {
364
+ effects . preview . refresh ( ) ;
365
+ actions . server . startContainer ( forkedSandbox ) ;
366
+ }
367
+
363
368
if ( state . workspace . openedWorkspaceItem === 'project-summary' ) {
364
369
actions . workspace . openDefaultItem ( ) ;
365
370
}
Original file line number Diff line number Diff line change 1
- import { Action } from 'app/overmind ' ;
1
+ import { ViewTab } from '@codesandbox/common/lib/templates/template ' ;
2
2
import {
3
- ServerStatus ,
3
+ Sandbox ,
4
4
ServerContainerStatus ,
5
5
ServerPort ,
6
+ ServerStatus ,
6
7
} from '@codesandbox/common/lib/types' ;
7
8
import { NotificationStatus } from '@codesandbox/notifications/lib/state' ;
9
+ import { Action , AsyncAction } from 'app/overmind' ;
8
10
import { getDevToolsTabPosition } from 'app/overmind/utils/server' ;
9
- import { ViewTab } from '@codesandbox/common/lib/templates/template' ;
10
11
11
12
export const restartSandbox : Action = ( { effects } ) => {
12
13
effects . executor . emit ( 'sandbox:restart' ) ;
@@ -222,3 +223,29 @@ export const onBrowserFromPortOpened: Action<{
222
223
} ) ;
223
224
}
224
225
} ;
226
+
227
+ export const startContainer : AsyncAction < Sandbox > = async (
228
+ { effects, actions } ,
229
+ sandbox
230
+ ) => {
231
+ await effects . executor . initializeExecutor ( sandbox ) ;
232
+
233
+ [
234
+ 'connect' ,
235
+ 'disconnect' ,
236
+ 'sandbox:status' ,
237
+ 'sandbox:start' ,
238
+ 'sandbox:stop' ,
239
+ 'sandbox:error' ,
240
+ 'sandbox:log' ,
241
+ 'sandbox:hibernate' ,
242
+ 'sandbox:update' ,
243
+ 'sandbox:port' ,
244
+ 'shell:out' ,
245
+ 'shell:exit' ,
246
+ ] . forEach ( message => {
247
+ effects . executor . listen ( message , actions . server . onSSEMessage ) ;
248
+ } ) ;
249
+
250
+ await effects . executor . setupExecutor ( ) ;
251
+ } ;
You can’t perform that action at this time.
0 commit comments