Fix order for joining spaces
This commit is contained in:
parent
9cb5e54aeb
commit
c694654417
3 changed files with 22 additions and 7 deletions
|
|
@ -23,6 +23,7 @@
|
|||
import SpaceJoinStatus from "@app/components/SpaceJoinStatus.svelte"
|
||||
import {pushToast} from "@app/toast"
|
||||
import {goToSpace} from "@app/routes"
|
||||
import {resyncApplicationData} from "@app/sync"
|
||||
import {relaysMostlyRestricted} from "@app/policies"
|
||||
import {notificationSettings, setSpaceNotifications} from "@app/settings"
|
||||
import {parseInviteLink} from "@app/invites"
|
||||
|
|
@ -69,11 +70,13 @@
|
|||
}
|
||||
|
||||
await addSpace(url)
|
||||
await goToSpace(url)
|
||||
|
||||
broadcastUserData([url])
|
||||
relaysMostlyRestricted.update(dissoc(url))
|
||||
pushToast({message: "Welcome to the space!"})
|
||||
relaysMostlyRestricted.update(dissoc(url))
|
||||
resyncApplicationData()
|
||||
broadcastUserData([url])
|
||||
|
||||
await goToSpace(url)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
import SpaceJoinStatus from "@app/components/SpaceJoinStatus.svelte"
|
||||
import {attemptRelayAccess} from "@app/relays"
|
||||
import {addSpace} from "@app/groups"
|
||||
import {resyncApplicationData} from "@app/sync"
|
||||
import {broadcastUserData} from "@app/profiles"
|
||||
import {setSpaceNotifications} from "@app/settings"
|
||||
import {relaysMostlyRestricted} from "@app/policies"
|
||||
|
|
@ -56,11 +57,13 @@
|
|||
}
|
||||
|
||||
await addSpace(url)
|
||||
await goToSpace(url)
|
||||
|
||||
broadcastUserData([url])
|
||||
relaysMostlyRestricted.update(dissoc(url))
|
||||
pushToast({message: "Welcome to the space!"})
|
||||
relaysMostlyRestricted.update(dissoc(url))
|
||||
resyncApplicationData()
|
||||
broadcastUserData([url])
|
||||
|
||||
await goToSpace(url)
|
||||
} catch (e) {
|
||||
console.error("Failed to join space:", e)
|
||||
pushToast({theme: "error", message: "Failed to join space. Please try again."})
|
||||
|
|
|
|||
|
|
@ -457,8 +457,17 @@ const syncDMs = () => {
|
|||
|
||||
// Merge all synchronization functions
|
||||
|
||||
let unsubscribe: Unsubscriber
|
||||
|
||||
export const syncApplicationData = () => {
|
||||
const unsubscribers = [syncRelays(), syncUserData(), syncSpaces(), syncDMs()]
|
||||
|
||||
return () => unsubscribers.forEach(call)
|
||||
unsubscribe = () => unsubscribers.forEach(call)
|
||||
|
||||
return unsubscribe
|
||||
}
|
||||
|
||||
export const resyncApplicationData = () => {
|
||||
unsubscribe?.()
|
||||
syncApplicationData()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue