refactor: minor performance improvements on teams related operations

This commit is contained in:
Andrew Bastin
2023-09-18 18:50:57 +05:30
parent bcc1147f81
commit 185b575e5b
16 changed files with 519 additions and 202 deletions

View File

@@ -69,11 +69,11 @@
<script setup lang="ts">
import { computed, ref } from "vue"
import { onLoggedIn } from "@composables/auth"
import TeamListAdapter from "~/helpers/teams/TeamListAdapter"
import { useI18n } from "@composables/i18n"
import { useReadonlyStream } from "@composables/stream"
import { useColorMode } from "@composables/theming"
import { WorkspaceService } from "~/services/workspace.service"
import { useService } from "dioc/vue"
const t = useI18n()
@@ -89,7 +89,8 @@ const showModalInvite = ref(false)
const editingTeam = ref<any>({}) // TODO: Check this out
const editingTeamID = ref<any>("")
const adapter = new TeamListAdapter(true)
const workspaceService = useService(WorkspaceService)
const adapter = workspaceService.acquireTeamListAdapter(10000)
const adapterLoading = useReadonlyStream(adapter.loading$, false)
const adapterError = useReadonlyStream(adapter.error$, null)
const myTeams = useReadonlyStream(adapter.teamList$, [])
@@ -98,12 +99,6 @@ const loading = computed(
() => adapterLoading.value && myTeams.value.length === 0
)
onLoggedIn(() => {
try {
adapter.initialize()
} catch (e) {}
})
const displayModalAdd = (shouldDisplay: boolean) => {
showModalAdd.value = shouldDisplay
adapter.fetchList()