diff --git a/src/App.tsx b/src/App.tsx index 88eedc42..6f317b96 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -79,11 +79,7 @@ async function fetchFromUrlParams( if (editorKey) { const result = await setupEditorIntegration(editorKey, dispatch, worker); if (result) { - const { origin, files } = result; - await dispatch({ - type: "setOrigin", - payload: { origin: "playground", tags: [`post:${origin}`] }, - }); + const { files } = result; return files; } } diff --git a/src/integrations/editorIntegration.ts b/src/integrations/editorIntegration.ts index 7c0799fe..02f55248 100644 --- a/src/integrations/editorIntegration.ts +++ b/src/integrations/editorIntegration.ts @@ -19,7 +19,6 @@ type EditorIntegrationResponse = { }; export interface EditorIntegrationResult { - origin: string; files: Record; } @@ -106,6 +105,11 @@ export async function setupEditorIntegration( }); } } + + await dispatch({ + type: "setOrigin", + payload: { origin: "playground", tags: [`post:${origin}`] }, + }); } catch (e) { console.error("Error in editor integration message listener:"); console.error(e); @@ -116,7 +120,6 @@ export async function setupEditorIntegration( // Load a default empty project previousResult = { - origin, files: { "Main.mo": "", },