diff --git a/web/js/main.tsx b/web/js/main.tsx index 1171cfc4..32dd4785 100644 --- a/web/js/main.tsx +++ b/web/js/main.tsx @@ -15,7 +15,12 @@ const j = (id: string): any | null => { return null; } - return JSON.parse(elem.textContent); + const text = elem.textContent; + if (text == null || text.trim() === "") { + return null; + } + + return JSON.parse(text); }; const imageURL = ( @@ -66,11 +71,10 @@ const getRedirectUrl = () => { }; let translations: Record = {}; -let currentLang: string; // Initialize translations const initTranslations = async () => { - currentLang = await getBrowserLanguage(); + const currentLang = await getBrowserLanguage(); translations = await loadTranslations(currentLang); }; @@ -281,7 +285,7 @@ function App({ anubisVersion, basePrefix }: AppProps) { )}

{phase === "reading" ? ( -
redirectFn.current?.()} > {t("finished_reading")} -
+ ) : (