feature/projects-all-the-way-down #3323
|
@ -15,8 +15,6 @@ import ProjectsNavigation from '@/components/home/ProjectsNavigation.vue'
|
|||
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
await projectStore.loadProjects()
|
||||
|
||||
const projects = computed(() => projectStore.notArchivedRootProjects
|
||||
|
||||
.sort((a, b) => a.position - b.position))
|
||||
const favoriteProjects = computed(() => projectStore.favoriteProjects
|
||||
konrad marked this conversation as resolved
Outdated
dpschen
commented
Non archived root projects seems like something that the store should provide as computed. Non archived root projects seems like something that the store should provide as computed.
konrad
commented
Done Done
|
||||
|
|
|
@ -69,6 +69,7 @@ import BaseButton from '@/components/base/BaseButton.vue'
|
|||
|
||||
import {useBaseStore} from '@/stores/base'
|
||||
import {useLabelStore} from '@/stores/labels'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
|
||||
import {useRouteWithModal} from '@/composables/useRouteWithModal'
|
||||
import {useRenewTokenOnFocus} from '@/composables/useRenewTokenOnFocus'
|
||||
|
@ -115,6 +116,9 @@ useRenewTokenOnFocus()
|
|||
|
||||
const labelStore = useLabelStore()
|
||||
labelStore.loadAllLabels()
|
||||
|
||||
const projectStore = useProjectStore()
|
||||
projectStore.loadProjects()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
@ -48,13 +48,8 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
<Suspense>
|
||||
<ProjectsNavigationWrapper/>
|
||||
|
||||
<template #fallback>
|
||||
<Loading variant="small"/>
|
||||
</template>
|
||||
</Suspense>
|
||||
<Loading variant="small" v-if="projectsLoading"/>
|
||||
dpschen marked this conversation as resolved
Outdated
dpschen
commented
Move Move `v-if` to front
konrad
commented
Done Done
|
||||
<ProjectsNavigationWrapper v-else/>
|
||||
|
||||
<PoweredByLink/>
|
||||
</aside>
|
||||
|
@ -68,10 +63,13 @@ import Logo from '@/components/home/Logo.vue'
|
|||
import Loading from '@/components/misc/loading.vue'
|
||||
|
||||
import {useBaseStore} from '@/stores/base'
|
||||
import {useProjectStore} from '@/stores/projects'
|
||||
import ProjectsNavigationWrapper from '@/components/home/ProjectsNavigationWrapper.vue'
|
||||
|
||||
const baseStore = useBaseStore()
|
||||
const projectStore = useProjectStore()
|
||||
const menuActive = computed(() => baseStore.menuActive)
|
||||
const projectsLoading = computed(() => projectStore.isLoading)
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
Reference in New Issue
Block a user
Call this in
App.vue
and add aisLoadingPromise
that contains the returned promise of theloadProjects
function to the projectStore which we then can await here instead.What would be the advantage of this? I feel like this would be a lot more complicated.
The loading of the projects would happen much earlier in the request chain.
Since they are an async dependency the optimal time to request the server would be the moment we know that we have are authenticated.
So I guess it Shouldn't be App but maybe contentAuth.
That's also the reason why we load all labels there.
I've now moved it to
contentAuth
but am using theisLoading
property of the project store to show the loading state. That means I can't use theSuspense
component, but the loading property already exists and is populated, might as well use it.That makes sense.
Now
ProjectsNavigationWrapper.vue
is so simple that it doesn't make sense to have it as dedicated component. The reason why it was created was for theSuspense
, right?Yes, I created it only to use it with
Suspense
. Should I include its contents back intonavigation
?I think that would be better now. Sry for the back and forth.
No worries, changed it back.