From f0debe6eee69faedb65a66b9e9ba973dc94f6245 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 4 Dec 2024 16:27:38 +0100 Subject: fix(funbox): css not cleared when toggling funbox --- frontend/src/ts/test/funbox/funbox.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/ts/test/funbox/funbox.ts b/frontend/src/ts/test/funbox/funbox.ts index b84423257..0aa9856ed 100644 --- a/frontend/src/ts/test/funbox/funbox.ts +++ b/frontend/src/ts/test/funbox/funbox.ts @@ -9,7 +9,7 @@ import * as FunboxMemory from "./funbox-memory"; import { HighlightMode } from "@monkeytype/contracts/schemas/configs"; import { Mode } from "@monkeytype/contracts/schemas/shared"; import { FunboxName, checkCompatibility } from "@monkeytype/funbox"; -import { getActiveFunboxes, getActiveFunboxNames } from "./list"; +import { getActiveFunboxes, getActiveFunboxNames, get } from "./list"; import { checkForcedConfig } from "./funbox-validation"; export function toggleScript(...params: string[]): void { @@ -51,12 +51,10 @@ export function toggleFunbox(funbox: "none" | FunboxName): boolean { FunboxMemory.load(); const e = UpdateConfig.toggleFunbox(funbox, false); - for (const fb of getActiveFunboxes()) { - if (!Config.funbox.includes(funbox)) { - fb.functions?.clearGlobal?.(); - } else { - fb.functions?.applyGlobalCSS?.(); - } + if (!getActiveFunboxNames().includes(funbox as FunboxName)) { + get(funbox as FunboxName).functions?.clearGlobal?.(); + } else { + get(funbox as FunboxName).functions?.applyGlobalCSS?.(); } //todo find out what the hell this means -- cgit v1.2.3