From c8d003524b167d76840808b8d93abc927594b79b Mon Sep 17 00:00:00 2001 From: Aditya Chaudhary <30+useradityaa@noreply.coracle.social> Date: Tue, 11 Aug 2026 16:45:49 +0000 Subject: [PATCH] Fix/spurious relay membership prompt (#340) Co-authored-by: Aditya Chaudhary <30+useradityaa@noreply.coracle.social> --- src/app/components/RelaySummary.svelte | 5 ++--- src/app/components/RoomChat.svelte | 1 - src/routes/spaces/[relay]/+layout.svelte | 10 +++++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/components/RelaySummary.svelte b/src/app/components/RelaySummary.svelte index 0ed417b0..26d91f32 100644 --- a/src/app/components/RelaySummary.svelte +++ b/src/app/components/RelaySummary.svelte @@ -7,7 +7,7 @@ import RelayDescription from "@app/components/RelayDescription.svelte" import ProfileCircles from "@app/components/ProfileCircles.svelte" import {roomLists, user} from "@app/core" - import {deriveUserRooms} from "@app/rooms" + import {userSpaceUrls} from "@app/rooms" type Props = { url: string @@ -15,7 +15,6 @@ } const {url, hideFavorites}: Props = $props() - const rooms = deriveUserRooms(url) const favorited = $roomLists.pubkeysForUrl(url).$ const favoritedPubkeys = $derived(remove($user.pubkey, $favorited)) @@ -30,7 +29,7 @@ - {#if $rooms.includes(url)} + {#if $userSpaceUrls.includes(url)}
diff --git a/src/app/components/RoomChat.svelte b/src/app/components/RoomChat.svelte index 5703187e..ab47ff1b 100644 --- a/src/app/components/RoomChat.svelte +++ b/src/app/components/RoomChat.svelte @@ -465,7 +465,6 @@ cleanup?.() unsubscribeActive() cancelAnimationFrame(frame) - document.removeEventListener("visibilitychange", onVisibilityChange) } }) diff --git a/src/routes/spaces/[relay]/+layout.svelte b/src/routes/spaces/[relay]/+layout.svelte index 00e21d13..f701d41a 100644 --- a/src/routes/spaces/[relay]/+layout.svelte +++ b/src/routes/spaces/[relay]/+layout.svelte @@ -55,7 +55,15 @@ const currentPubkey = user.get().pubkey if (currentPubkey) { - await $roomLists.load(currentPubkey, [url]) + // Force a fresh fetch rather than `load`, which can resolve immediately from an + // hour-stale cache and make a space the user has since joined look unjoined. + // Unlike `load`, `forceLoad` doesn't swallow fetch errors, so catch them here — + // otherwise a failed fetch would leave spacesLoaded false forever. + try { + await $roomLists.forceLoad(currentPubkey, [url]) + } catch (error) { + console.warn(`Failed to load room list for ${currentPubkey}`, error) + } } spacesLoaded = true