feat: prompt SpaceJoin when opening unjoined space via direct link #291
Reference in New Issue
Block a user
Delete Branch "userAdityaa/flotilla:286-prompt-space-join-on-direct-link"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 againstuserSpaceUrlsafterloadUserGroupList()and opens the existingSpaceJoinmodal 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
@@ -28,6 +31,8 @@const showPendingTrust = once(() => pushModal(SpaceTrustRelay, {url}, {noEscape: true}))const joinPrompted = new Set<string>()Does this need to be durable across page transitions? I would think so, but I don't completely understand the logic here.
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 = falsevoid loadUserGroupList().then(() => {deriveUserGroupList auto-loads, allowing you to avoid a lot of this complex logic. Switch to that and then you can use
$derivedinstead of$effect(or at least a very small effect which reacts to a derived store)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.
a2a3c52e89tofc6a3e44d4Looks good, just one nitpick
@@ -772,6 +772,8 @@ export const getSpaceRoomsFromGroupList = (url: string, groupList: List | undefiexport const userGroupList = makeUserData(groupListsByPubkey, loadGroupList)export const deriveUserGroupList = userGroupListJust use userGroupList, aliases are lame. I just forgot what it was called.
fc6a3e44d4to42d3c296eb42d3c296ebtoc121f9d2eb