File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 1212 }
1313 __sentryMark (' head-start' );
1414 </script >
15+ <link rel =" preload" href =" /api/client-config/" as =" fetch" crossorigin />
16+ <script >
17+ // Django inlines a class for the user theme, but SPA mode requires manual init.
18+ // Default to `.theme-system` and replace with user theme as soon as possible.
19+ const BOOTSTRAP_URL = ' /api/client-config/' ;
20+ async function applySpaTheme () {
21+ const res = await fetch (BOOTSTRAP_URL );
22+ if (res .ok ) {
23+ const data = await res .then (res => res .json ());
24+ const theme = data .user ? .options ? .theme ;
25+ if (theme) {
26+ document .body .classList .replace (' theme-system' , ` theme-${ theme} ` );
27+ return ;
28+ }
29+ }
30+ document .body .classList .remove (' theme-system' );
31+ }
32+ applySpaTheme ();
33+ < / script>
1534 < / head>
16-
17- <body >
35+ < body class = " theme-system" >
1836 < % if (htmlWebpackPlugin .options .unsupportedBrowser ) { % >
1937 < style> .unsupported - browser { display: none; }< / style>
2038 < div class = " unsupported-browser" >
You can’t perform that action at this time.
0 commit comments