Skip to content

Commit 8c9a35f

Browse files
Merge pull request #95 from alvin000009238/codex/fix-csp-issue-with-inline-theme-init-script-i8s1np
Cache chart theme palette, add theme-init, expose chart test hooks, and add theme tests
2 parents 6f9ee92 + 1c75fec commit 8c9a35f

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

public/theme-init.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
(() => {
2-
const storedTheme = localStorage.getItem('grades-theme');
3-
if (storedTheme === 'light') {
4-
document.documentElement.setAttribute('data-theme', 'light');
2+
try {
3+
const storedTheme = localStorage.getItem('grades-theme');
4+
if (storedTheme === 'light') {
5+
document.documentElement.setAttribute('data-theme', 'light');
6+
}
7+
} catch {
8+
// Ignore storage access failures (privacy mode / blocked storage)
9+
// and keep default theme.
510
}
611
})();

0 commit comments

Comments
 (0)