File tree Expand file tree Collapse file tree 3 files changed +36
-23
lines changed
packages/app/src/app/overmind Expand file tree Collapse file tree 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 (
261261 state . workspace . project . description = sandbox . description || '' ;
262262 state . workspace . project . alias = sandbox . alias || '' ;
263263
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 ) ;
284265} ;
285266
286267export const updateCurrentSandbox : AsyncAction < Sandbox > = async (
Original file line number Diff line number Diff line change @@ -360,6 +360,11 @@ export const forkSandbox: AsyncAction<{
360360 ) ;
361361 effects . preview . updateAddressbarUrl ( ) ;
362362
363+ if ( templateDefinition . isServer ) {
364+ effects . preview . refresh ( ) ;
365+ actions . server . startContainer ( forkedSandbox ) ;
366+ }
367+
363368 if ( state . workspace . openedWorkspaceItem === 'project-summary' ) {
364369 actions . workspace . openDefaultItem ( ) ;
365370 }
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 ' ;
22import {
3- ServerStatus ,
3+ Sandbox ,
44 ServerContainerStatus ,
55 ServerPort ,
6+ ServerStatus ,
67} from '@codesandbox/common/lib/types' ;
78import { NotificationStatus } from '@codesandbox/notifications/lib/state' ;
9+ import { Action , AsyncAction } from 'app/overmind' ;
810import { getDevToolsTabPosition } from 'app/overmind/utils/server' ;
9- import { ViewTab } from '@codesandbox/common/lib/templates/template' ;
1011
1112export const restartSandbox : Action = ( { effects } ) => {
1213 effects . executor . emit ( 'sandbox:restart' ) ;
@@ -222,3 +223,29 @@ export const onBrowserFromPortOpened: Action<{
222223 } ) ;
223224 }
224225} ;
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