Skip to content

Commit 28ae6e1

Browse files
Fallback option
1 parent 9528b59 commit 28ae6e1

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

production/theme.mjs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@ import { CG } from "./skilljar-theme-v3.0/CG.mjs";
1717
import { showBody } from "./skilljar-theme-v3.0/styling.mjs";
1818
import { route, preRoute, postRoute } from "./skilljar-theme-v3.0/router.mjs";
1919
import { setupDebug } from "./skilljar-theme-v3.0/debug.mjs";
20+
import { logger } from "./skilljar-theme-v3.0/logger.mjs";
2021

2122
document.addEventListener("DOMContentLoaded", () => {
22-
if (CG.env.isAdmin) setupDebug();
23+
try {
24+
if (CG.env.isAdmin) setupDebug();
2325

24-
preRoute();
25-
route();
26-
postRoute();
27-
28-
// show all
29-
showBody();
26+
preRoute();
27+
route();
28+
postRoute();
29+
} catch (err) {
30+
logger.error("Theme setup failed — page will render unstyled.", err);
31+
} finally {
32+
// Always show the body; preload.js hides it to prevent FOUC and we must
33+
// re-show it regardless of whether the theme applied successfully.
34+
showBody();
35+
}
3036
});

0 commit comments

Comments
 (0)