mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-09 16:53:36 -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(() => {
|
||||
const font = theme.getFont() ?? DEFAULT_FONT;
|
||||
root.setProperty("--font", `"${font}"`);
|
||||
FONTS[font].load();
|
||||
try {
|
||||
FONTS[font].load();
|
||||
} catch (err) {
|
||||
console.error(`Failed to load font: ${font}`);
|
||||
}
|
||||
}, [root, theme.getFont()]);
|
||||
|
||||
useEffect(() => {
|
||||
const font = theme.getMonospaceFont() ?? DEFAULT_MONO_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()]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
Loading…
Reference in a new issue