Skip to content

Commit baaea33

Browse files
committed
refactor: ready function now awaits config to be loaded to avoid concurrency issues
1 parent a670438 commit baaea33

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

frontend/src/ts/ready.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import * as AccountButton from "./elements/account-button";
88
import Konami from "konami";
99
import * as ServerConfiguration from "./ape/server-configuration";
1010
import { getActiveFunboxes } from "./test/funbox/list";
11+
import { loadPromise } from "./config";
1112

12-
$((): void => {
13+
$(async (): Promise<void> => {
14+
await loadPromise;
1315
Misc.loadCSS("/css/slimselect.min.css", true);
1416
Misc.loadCSS("/css/balloon.min.css", true);
1517

@@ -19,11 +21,10 @@ $((): void => {
1921
//to make sure the initial theme application doesnt animate the background color
2022
$("body").css("transition", "background .25s, transform .05s");
2123
MerchBanner.showIfNotClosedBefore();
22-
setTimeout(() => {
23-
for (const fb of getActiveFunboxes()) {
24-
fb.functions?.applyGlobalCSS?.();
25-
}
26-
}, 500); //this approach will probably bite me in the ass at some point
24+
25+
for (const fb of getActiveFunboxes()) {
26+
fb.functions?.applyGlobalCSS?.();
27+
}
2728

2829
$("#app")
2930
.css("opacity", "0")

0 commit comments

Comments
 (0)