Skip to content

Commit 989cd1d

Browse files
fix forking
1 parent 4e8a18e commit 989cd1d

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

packages/app/src/app/overmind/namespaces/editor/actions.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ export const npmDependencyRemoved: AsyncAction<{
6868
export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
6969
id: string;
7070
}>(async ({ state, actions, effects }, { id }) => {
71+
// This happens when we fork. This can be avoided with state first routing
72+
if (state.editor.isForkingSandbox) {
73+
effects.vscode.openModule(state.editor.currentModule);
74+
state.editor.isForkingSandbox = false;
75+
return;
76+
}
77+
7178
await effects.vscode.closeAllTabs();
7279

7380
state.editor.error = null;
@@ -76,11 +83,6 @@ export const sandboxChanged: AsyncAction<{ id: string }> = withLoadApp<{
7683

7784
newId = actions.editor.internal.ensureSandboxId(newId);
7885

79-
// This happens when we fork. This can be avoided with state first routing
80-
if (state.editor.isForkingSandbox) {
81-
return;
82-
}
83-
8486
const hasExistingSandbox = Boolean(state.editor.currentId);
8587

8688
if (state.live.isLive) {

packages/app/src/app/overmind/namespaces/editor/internalActions.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ export const forkSandbox: AsyncAction<{
331331
state.editor.modulesByPath = fs;
332332
});
333333

334-
effects.vscode.openModule(state.editor.currentModule);
335334
effects.preview.executeCodeImmediately(true);
336335

337336
// When not server we "piggyback" the existing Sandbox to avoid any rerenders and need
@@ -353,8 +352,6 @@ export const forkSandbox: AsyncAction<{
353352
console.error(error);
354353
effects.notificationToast.error('Sorry, unable to fork this sandbox');
355354
}
356-
357-
state.editor.isForkingSandbox = false;
358355
};
359356

360357
export const setCurrentModule: AsyncAction<Module> = async (

0 commit comments

Comments
 (0)