Skip to content

Commit

Permalink
fixup! Refactor(Mixin): Migrate getParticipants mixin to composable
Browse files Browse the repository at this point in the history
  • Loading branch information
DorraJaouad committed Jan 5, 2024
1 parent b264f24 commit ebb2985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/components/RightSidebar/Participants/ParticipantsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export default {
participantsInitialised,
cancelableGetParticipants,
initialiseGetParticipants,
stopGetParticipants,
} = useGetParticipants(isActive)

return {
Expand All @@ -141,7 +140,6 @@ export default {
participantsInitialised,
cancelableGetParticipants,
initialiseGetParticipants,
stopGetParticipants,
}
},

Expand Down Expand Up @@ -209,7 +207,7 @@ export default {
EventBus.$on('route-change', this.abortSearch)
subscribe('user_status:status.updated', this.updateUserStatus)

// Initialises the get participants mixin
// Initialises the get participants composable
this.initialiseGetParticipants()
},

Expand All @@ -219,8 +217,6 @@ export default {

this.cancelSearchPossibleConversations()
this.cancelSearchPossibleConversations = null

this.stopGetParticipants()
},

methods: {
Expand Down
9 changes: 7 additions & 2 deletions src/composables/useGetParticipants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/
import debounce from 'debounce'
import { ref, nextTick, computed, watch } from 'vue'
import { ref, nextTick, computed, watch, onBeforeUnmount } from 'vue'

import { subscribe, unsubscribe } from '@nextcloud/event-bus'

Expand Down Expand Up @@ -138,10 +138,15 @@ export function useGetParticipants(isActive = ref(true)) {
}
})

onBeforeUnmount(
() => {
stopGetParticipants()
}
)

return {
participantsInitialised,
initialiseGetParticipants,
stopGetParticipants,
cancelableGetParticipants,
}
}

0 comments on commit ebb2985

Please sign in to comment.