From 6a1c3f8225dd919640bdcb63e25add6463c38ddf Mon Sep 17 00:00:00 2001 From: Alexandre Stahmer Date: Wed, 12 Jul 2023 00:57:37 +0200 Subject: [PATCH] fix: playground swap tab get editor value --- src/components/Playground/Playground.machine.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/Playground/Playground.machine.ts b/src/components/Playground/Playground.machine.ts index c668b46..c4d25ee 100644 --- a/src/components/Playground/Playground.machine.ts +++ b/src/components/Playground/Playground.machine.ts @@ -56,6 +56,7 @@ globalThis.__dirname = "/"; export const playgroundMachine = createMachine( { predictableActionArguments: true, + preserveActionOrder: true, id: "playground", tsTypes: {} as import("./Playground.machine.typegen").Typegen0, schema: { @@ -112,10 +113,6 @@ export const playgroundMachine = createMachine( updateSelectedInput: assign((ctx, event) => { if (event.type !== "Update input") return ctx; - // if (ctx.inputEditor) { - // ctx.inputEditor.setValue(event.value); - // } - const { inputList, selectedInput } = ctx; if (inputList[selectedInput]) { inputList[selectedInput] = event.value; @@ -131,9 +128,9 @@ export const playgroundMachine = createMachine( ]), extractClassList: assign((ctx, event) => { const value = - event.type === "Update input" + (event.type === "Update input" ? event.value - : ctx.inputEditor?.getValue() ?? ""; + : ctx.inputList[ctx.selectedInput]) ?? ""; const themeContent = ctx.inputList["theme.ts"] ?? "module.exports = {}"; const tw = createTailwindContext(themeContent);