feat: prompt SpaceJoin when opening unjoined space via direct link #291

Merged
hodlbod merged 1 commits from userAdityaa/flotilla:286-prompt-space-join-on-direct-link into dev 2026-06-08 21:15:37 +00:00
Collaborator

Summary

Direct links to /spaces/{relay}/… (rooms, voice, etc.) previously skipped the join flow that Discover already uses, so users could land in a space they had never bookmarked with no guidance. This adds a layout-level check against userSpaceUrls after loadUserGroupList() and opens the existing SpaceJoin modal when the relay is missing from the list. Auth and trust modals still take precedence; bookmarked spaces are unchanged. No auto NIP-43 join on visit.

closes #286

### Summary Direct links to `/spaces/{relay}/…` (rooms, voice, etc.) previously skipped the join flow that Discover already uses, so users could land in a space they had never bookmarked with no guidance. This adds a layout-level check against `userSpaceUrls` after `loadUserGroupList()` and opens the existing `SpaceJoin` modal when the relay is missing from the list. Auth and trust modals still take precedence; bookmarked spaces are unchanged. No auto NIP-43 join on visit. closes #286
hodlbod reviewed 2026-06-04 21:51:02 +00:00
@@ -28,6 +31,8 @@
const showPendingTrust = once(() => pushModal(SpaceTrustRelay, {url}, {noEscape: true}))
const joinPrompted = new Set<string>()
Owner

Does this need to be durable across page transitions? I would think so, but I don't completely understand the logic here.

Does this need to be durable across page transitions? I would think so, but I don't completely understand the logic here.
Author
Collaborator

yes, it should be durable for session.

I’ve moved it to module scope (<script module>) so it survives layout remounts (switching relays, leaving and coming back) for the lifetime of the page session. I also removed the effect cleanup that was calling joinPrompted.delete(spaceUrl), which was clearing that memory whenever the effect re-ran and could cause duplicate prompts

yes, it should be durable for session. I’ve moved it to module scope (<script module>) so it survives layout remounts (switching relays, leaving and coming back) for the lifetime of the page session. I also removed the effect cleanup that was calling joinPrompted.delete(spaceUrl), which was clearing that memory whenever the effect re-ran and could cause duplicate prompts
@@ -39,0 +57,4 @@
let cancelled = false
void loadUserGroupList().then(() => {
Owner

deriveUserGroupList auto-loads, allowing you to avoid a lot of this complex logic. Switch to that and then you can use $derived instead of $effect (or at least a very small effect which reacts to a derived store)

deriveUserGroupList auto-loads, allowing you to avoid a lot of this complex logic. Switch to that and then you can use `$derived` instead of `$effect` (or at least a very small effect which reacts to a derived store)
Author
Collaborator

Switched to deriveUserGroupList (alias for userGroupList) so the group list auto-loads on subscribe via makeUserData, instead of manually calling loadUserGroupList().then() with cancellation/pubkey re-check logic.

Switched to deriveUserGroupList (alias for userGroupList) so the group list auto-loads on subscribe via makeUserData, instead of manually calling loadUserGroupList().then() with cancellation/pubkey re-check logic.
hodlbod marked this conversation as resolved
userAdityaa force-pushed 286-prompt-space-join-on-direct-link from a2a3c52e89 to fc6a3e44d4 2026-06-08 10:41:19 +00:00 Compare
hodlbod reviewed 2026-06-08 15:55:57 +00:00
hodlbod left a comment
Owner

Looks good, just one nitpick

Looks good, just one nitpick
@@ -772,6 +772,8 @@ export const getSpaceRoomsFromGroupList = (url: string, groupList: List | undefi
export const userGroupList = makeUserData(groupListsByPubkey, loadGroupList)
export const deriveUserGroupList = userGroupList
Owner

Just use userGroupList, aliases are lame. I just forgot what it was called.

Just use userGroupList, aliases are lame. I just forgot what it was called.
userAdityaa force-pushed 286-prompt-space-join-on-direct-link from fc6a3e44d4 to 42d3c296eb 2026-06-08 17:54:43 +00:00 Compare
hodlbod added 1 commit 2026-06-08 21:15:31 +00:00
hodlbod force-pushed 286-prompt-space-join-on-direct-link from 42d3c296eb to c121f9d2eb 2026-06-08 21:15:31 +00:00 Compare
hodlbod merged commit 8ba76a60e7 into dev 2026-06-08 21:15:37 +00:00
hodlbod deleted branch 286-prompt-space-join-on-direct-link 2026-06-08 21:15:37 +00:00
Sign in to join this conversation.