From 9c8cb5611f64e82e94de35428583de0aaa40b656 Mon Sep 17 00:00:00 2001 From: wukko Date: Wed, 20 Nov 2024 14:26:45 +0600 Subject: [PATCH] web/server-info: reload the page only if the sitekey actually changed --- web/src/lib/api/server-info.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/web/src/lib/api/server-info.ts b/web/src/lib/api/server-info.ts index 8a3e1b60..0f36ceff 100644 --- a/web/src/lib/api/server-info.ts +++ b/web/src/lib/api/server-info.ts @@ -53,14 +53,9 @@ export const getServerInfo = async () => { origin: currentApiURL(), }); - /* - reload the page if turnstile sitekey changed. - there's no other proper way to do this, at least i couldn't find any :( - */ - if (cache?.info?.cobalt?.turnstileSitekey && freshInfo?.cobalt?.turnstileSitekey) { - if (browser) { - window.location.reload(); - } + // reload the page if turnstile sitekey changed + if (cache && cache?.info?.cobalt?.turnstileSitekey !== freshInfo?.cobalt?.turnstileSitekey) { + if (browser) window.location.reload(); } return true;