"Create Invite" shows wrong error message when offline #204

Closed
opened 2026-04-15 13:35:14 +00:00 by DeveshSingh · 4 comments
Contributor

When a user is offline, the "Create an Invite" modal incorrectly displays:

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

This is misleading because the user is a member — the request simply failed due to no network connectivity.

Expected Behavior:
Show a network-aware message like:

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

Root Cause:
In SpaceInvite.svelte, the component checks $authError (from deriveRelayAuthError) to decide what to show. However, this flag gets set to true for any failed request — including offline failures — so offline errors are incorrectly treated as "not a member" errors.

When a user is offline, the "Create an Invite" modal incorrectly displays: "Oops! It looks like you're not a member of this relay." This is misleading because the user is a member — the request simply failed due to no network connectivity. Expected Behavior: Show a network-aware message like: "Unable to reach the relay. Please check your connection and try again." Root Cause: In SpaceInvite.svelte, the component checks $authError (from deriveRelayAuthError) to decide what to show. However, this flag gets set to true for any failed request — including offline failures — so offline errors are incorrectly treated as "not a member" errors.
Author
Contributor

Hi @hodlbod , i want to work on this issue

Hi @hodlbod , i want to work on this issue
Author
Contributor

In SpaceInvite.svelte, I added navigator.onLine state tracked via window online/offline events. Now the template checks !isOnline before $authError, showing "You appear to be offline" instead of the misleading "not a member of this relay" message when the user has no network connection.

In SpaceInvite.svelte, I added navigator.onLine state tracked via window online/offline events. Now the template checks !isOnline before $authError, showing "You appear to be offline" instead of the misleading "not a member of this relay" message when the user has no network connection.
Collaborator

Good catch @DeveshSingh, the issue is real, but your navigator.onLine logic seems to be a decent quick fix, but

navigator.onLine is heuristic. It can still be true while relay is unreachable (DNS issues, captive portal, relay down, partial connectivity), so wrong messaging can still happen.
See this: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine

and also from the image you have shared, make the actual error text to be center aligned, that will feel good UI-wise.

Good catch @DeveshSingh, the issue is real, but your `navigator.onLine` logic seems to be a decent quick fix, but `navigator.onLine` is heuristic. It can still be true while relay is unreachable (DNS issues, captive portal, relay down, partial connectivity), so wrong messaging can still happen. See this: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine and also from the image you have shared, make the actual error text to be center aligned, that will feel good UI-wise.
Author
Contributor

Good catch @DeveshSingh, the issue is real, but your navigator.onLine logic seems to be a decent quick fix, but

navigator.onLine is heuristic. It can still be true while relay is unreachable (DNS issues, captive portal, relay down, partial connectivity), so wrong messaging can still happen.
See this: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine

and also from the image you have shared, make the actual error text to be center aligned, that will feel good UI-wise.

On it @userAdityaa

Good point — I moved away from relying on navigator.onLine and now classify errors based on request failures (including timeout). Auth errors are only shown when explicitly detected, and other cases fall back to a generic error.
And I have centered the error message.
@userAdityaa

> > Good catch @DeveshSingh, the issue is real, but your `navigator.onLine` logic seems to be a decent quick fix, but > > > > `navigator.onLine` is heuristic. It can still be true while relay is unreachable (DNS issues, captive portal, relay down, partial connectivity), so wrong messaging can still happen. > > See this: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine > > > > and also from the image you have shared, make the actual error text to be center aligned, that will feel good UI-wise. > > On it @userAdityaa Good point — I moved away from relying on navigator.onLine and now classify errors based on request failures (including timeout). Auth errors are only shown when explicitly detected, and other cases fall back to a generic error. And I have centered the error message. @userAdityaa
DeveshSingh was assigned by hodlbod 2026-04-15 21:04:11 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: coracle/flotilla#204