Skip to content

Commit 15497a7

Browse files
committed
Fix creating sandboxes from dashboard
1 parent ea6dcf3 commit 15497a7

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ export const createSandboxClicked: AsyncAction<{
6868
body: { collectionId: string };
6969
sandboxId: string;
7070
}> = ({ actions }, { body, sandboxId }) =>
71-
actions.editor.internal.forkSandbox({ body, sandboxId });
71+
actions.editor.forkExternalSandbox({ body, sandboxId });

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,17 @@ export const createZipClicked: Action = ({ state, effects }) => {
261261
effects.zip.download(state.editor.currentSandbox);
262262
};
263263

264-
export const forkExternalSandbox: AsyncAction<string> = async (
265-
{ actions },
266-
sandboxId
267-
) => {
268-
await actions.editor.internal.forkSandbox({
269-
sandboxId,
270-
});
264+
export const forkExternalSandbox: AsyncAction<{
265+
sandboxId: string;
266+
openInNewWindow?: boolean;
267+
body?: { collectionId: string };
268+
}> = async ({ effects, state }, { sandboxId, openInNewWindow, body }) => {
269+
effects.analytics.track('Fork Sandbox', { type: 'external' });
270+
271+
const forkedSandbox = await effects.api.forkSandbox(sandboxId, body);
272+
273+
state.editor.sandboxes[forkedSandbox.id] = forkedSandbox;
274+
effects.router.updateSandboxUrl(forkedSandbox, { openInNewWindow });
271275
};
272276

273277
export const forkSandboxClicked: AsyncAction = async ({

0 commit comments

Comments
 (0)