Skip to content

Commit

Permalink
fix: playground swap tab get editor value
Browse files Browse the repository at this point in the history
  • Loading branch information
astahmer committed Jul 11, 2023
1 parent 544165d commit 6a1c3f8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/components/Playground/Playground.machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ globalThis.__dirname = "/";
export const playgroundMachine = createMachine(
{
predictableActionArguments: true,
preserveActionOrder: true,
id: "playground",
tsTypes: {} as import("./Playground.machine.typegen").Typegen0,
schema: {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 6a1c3f8

Please sign in to comment.