mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-22 00:00:56 -05:00
fix(theme): don't crash the app on invalid fonts
This commit is contained in:
parent
334e54146b
commit
edaf2256d5
1 changed files with 10 additions and 2 deletions
|
@ -330,13 +330,21 @@ export default observer(() => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const font = theme.getFont() ?? DEFAULT_FONT;
|
const font = theme.getFont() ?? DEFAULT_FONT;
|
||||||
root.setProperty("--font", `"${font}"`);
|
root.setProperty("--font", `"${font}"`);
|
||||||
FONTS[font].load();
|
try {
|
||||||
|
FONTS[font].load();
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Failed to load font: ${font}`);
|
||||||
|
}
|
||||||
}, [root, theme.getFont()]);
|
}, [root, theme.getFont()]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const font = theme.getMonospaceFont() ?? DEFAULT_MONO_FONT;
|
const font = theme.getMonospaceFont() ?? DEFAULT_MONO_FONT;
|
||||||
root.setProperty("--monospace-font", `"${font}"`);
|
root.setProperty("--monospace-font", `"${font}"`);
|
||||||
MONOSPACE_FONTS[font].load();
|
try {
|
||||||
|
MONOSPACE_FONTS[font].load();
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Failed to load monospace font: ${font}`);
|
||||||
|
}
|
||||||
}, [root, theme.getMonospaceFont()]);
|
}, [root, theme.getMonospaceFont()]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue