Styles: Fix disabling styles + order of operations when returning if the style was disabled

I have no idea how I didn't catch this sooner.
This commit is contained in:
Sqaaakoi 2025-02-12 00:44:28 +13:00
parent 2595691a9e
commit 73e5110f6c
No known key found for this signature in database

View file

@ -51,13 +51,12 @@ function findDocuments() {
export function enableStyle(style: Style | string) { export function enableStyle(style: Style | string) {
if (typeof style === "string") style = requireStyle(style); if (typeof style === "string") style = requireStyle(style);
const previousState = style.enabled;
style.enabled = true; style.enabled = true;
compileStyle(style); compileStyle(style);
if (style.enabled) return !previousState;
return false;
return true;
} }
/** /**
@ -74,13 +73,12 @@ export function disableStyle(style: Style | string) {
} }
} }
compileStyle(style); const previousState = style.enabled;
if (!style.enabled)
return false;
style.enabled = false; style.enabled = false;
return true; compileStyle(style);
return previousState;
} }
/** /**