diff --git a/apps/ui/src/components/ButtonFollow.vue b/apps/ui/src/components/ButtonFollow.vue index 748aee6f1..404253817 100644 --- a/apps/ui/src/components/ButtonFollow.vue +++ b/apps/ui/src/components/ButtonFollow.vue @@ -12,7 +12,9 @@ const followedSpacesStore = useFollowedSpacesStore(); const spaceFollowed = computed(() => followedSpacesStore.isFollowed(spaceIdComposite)); const loading = computed( - () => !followedSpacesStore.followedSpacesLoaded || followedSpacesStore.followedSpaceLoading + () => + !followedSpacesStore.followedSpacesLoaded || + followedSpacesStore.followedSpaceLoading.has(spaceIdComposite) ); diff --git a/apps/ui/src/stores/followedSpaces.ts b/apps/ui/src/stores/followedSpaces.ts index 93b40f5bb..b3096d674 100644 --- a/apps/ui/src/stores/followedSpaces.ts +++ b/apps/ui/src/stores/followedSpaces.ts @@ -17,7 +17,7 @@ export const useFollowedSpacesStore = defineStore('followedSpaces', () => { const followedSpacesIds = ref([]); const followedSpacesLoaded = ref(false); - const followedSpaceLoading = ref(false); + const followedSpaceLoading = reactive(new Set()); const followedSpacesIdsByAccount = useStorage( `${pkg.name}.spaces-followed`, {} as Record @@ -88,7 +88,7 @@ export const useFollowedSpacesStore = defineStore('followedSpaces', () => { async function toggleSpaceFollow(id: string) { const alreadyFollowed = followedSpacesIds.value.includes(id); const [spaceNetwork, spaceId] = id.split(':') as [NetworkID, string]; - followedSpaceLoading.value = true; + followedSpaceLoading.add(id); try { if (alreadyFollowed) { @@ -111,7 +111,7 @@ export const useFollowedSpacesStore = defineStore('followedSpaces', () => { followedSpacesIdsByAccount.value[web3.value.account].unshift(id); } } finally { - followedSpaceLoading.value = false; + followedSpaceLoading.delete(id); } }