feat: load all projects earlier than in the navigation and use the loading state of the store

This commit is contained in:
kolaente 2023-04-02 14:52:28 +02:00
parent 76814a2d3f
commit 1d936618fa
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 9 additions and 9 deletions

View File

@ -15,8 +15,6 @@ import ProjectsNavigation from '@/components/home/ProjectsNavigation.vue'
const projectStore = useProjectStore() const projectStore = useProjectStore()
await projectStore.loadProjects()
const projects = computed(() => projectStore.notArchivedRootProjects const projects = computed(() => projectStore.notArchivedRootProjects
.sort((a, b) => a.position - b.position)) .sort((a, b) => a.position - b.position))
const favoriteProjects = computed(() => projectStore.favoriteProjects const favoriteProjects = computed(() => projectStore.favoriteProjects

View File

@ -69,6 +69,7 @@ import BaseButton from '@/components/base/BaseButton.vue'
import {useBaseStore} from '@/stores/base' import {useBaseStore} from '@/stores/base'
import {useLabelStore} from '@/stores/labels' import {useLabelStore} from '@/stores/labels'
import {useProjectStore} from '@/stores/projects'
import {useRouteWithModal} from '@/composables/useRouteWithModal' import {useRouteWithModal} from '@/composables/useRouteWithModal'
import {useRenewTokenOnFocus} from '@/composables/useRenewTokenOnFocus' import {useRenewTokenOnFocus} from '@/composables/useRenewTokenOnFocus'
@ -115,6 +116,9 @@ useRenewTokenOnFocus()
const labelStore = useLabelStore() const labelStore = useLabelStore()
labelStore.loadAllLabels() labelStore.loadAllLabels()
const projectStore = useProjectStore()
projectStore.loadProjects()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -48,13 +48,8 @@
</ul> </ul>
</nav> </nav>
<Suspense> <Loading variant="small" v-if="projectsLoading"/>
<ProjectsNavigationWrapper/> <ProjectsNavigationWrapper v-else/>
<template #fallback>
<Loading variant="small"/>
</template>
</Suspense>
<PoweredByLink/> <PoweredByLink/>
</aside> </aside>
@ -68,10 +63,13 @@ import Logo from '@/components/home/Logo.vue'
import Loading from '@/components/misc/loading.vue' import Loading from '@/components/misc/loading.vue'
import {useBaseStore} from '@/stores/base' import {useBaseStore} from '@/stores/base'
import {useProjectStore} from '@/stores/projects'
import ProjectsNavigationWrapper from '@/components/home/ProjectsNavigationWrapper.vue' import ProjectsNavigationWrapper from '@/components/home/ProjectsNavigationWrapper.vue'
const baseStore = useBaseStore() const baseStore = useBaseStore()
const projectStore = useProjectStore()
const menuActive = computed(() => baseStore.menuActive) const menuActive = computed(() => baseStore.menuActive)
const projectsLoading = computed(() => projectStore.isLoading)
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>