From a4b35d9774739f8d29bec4a76bc3645253738ee5 Mon Sep 17 00:00:00 2001 From: deveshanim3 Date: Fri, 17 Apr 2026 20:00:52 +0530 Subject: [PATCH] fix:"Create Invite" shows wrong error message when offline --- src/app/components/SpaceInvite.svelte | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app/components/SpaceInvite.svelte b/src/app/components/SpaceInvite.svelte index 708375b4..f28c22c7 100644 --- a/src/app/components/SpaceInvite.svelte +++ b/src/app/components/SpaceInvite.svelte @@ -26,7 +26,14 @@ const authError = deriveRelayAuthError(url) let networkError = $state(false) - const isExplicitAuthError = $derived($authError && !($authError.toLowerCase().includes("failed") || $authError.toLowerCase().includes("timeout") || $authError.toLowerCase().includes("network"))) + const isExplicitAuthError = $derived( + $authError && + !( + $authError.toLowerCase().includes("failed") || + $authError.toLowerCase().includes("timeout") || + $authError.toLowerCase().includes("network") + ), + ) const isGenericError = $derived(networkError || ($authError && !isExplicitAuthError)) const back = () => history.back() @@ -75,7 +82,10 @@ claim = getTagValue("claim", event?.tags || []) || "" } catch (err) { claim = "" - if ((err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) || !navigator.onLine) { + if ( + (err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) || + !navigator.onLine + ) { networkError = true } } finally { @@ -99,7 +109,9 @@ Requesting an invite link...

{:else if isGenericError} -

Unable to reach the relay. Please check your connection and try again.

+

+ Unable to reach the relay. Please check your connection and try again. +

{:else if isExplicitAuthError}

Oops! It looks like you're not a member of this relay.

{:else}