feature/projects-all-the-way-down #3323

Merged
konrad merged 123 commits from feature/projects-all-the-way-down into main 2023-05-30 10:09:40 +00:00
Showing only changes of commit d85be26761 - Show all commits

View File

@ -1,10 +1,10 @@
<template>
<nav class="menu" v-if="favoriteProjects">

Didn't check / thought: I think to remember that menu is a class also coming from bulma.

If that's the case: does that mean that we pass these styles down here? Could we instead add the menu class inside ProjectsNavigation or wouldn't that work because of the recurrsion?

Didn't check / thought: I think to remember that `menu` is a class also coming from bulma. If that's the case: does that mean that we pass these styles down here? Could we instead add the menu class inside ProjectsNavigation or wouldn't that work because of the recurrsion?

Yes, .menu is a class from bulma.

does that mean that we pass these styles down here? Could we instead add the menu class inside ProjectsNavigation or wouldn't that work because of the recurrsion?

You mean adding the class into the styles definition of the ProjectsNavigation component?

Yes, `.menu` is a class from bulma. > does that mean that we pass these styles down here? Could we instead add the menu class inside ProjectsNavigation or wouldn't that work because of the recurrsion? You mean adding the class into the styles definition of the `ProjectsNavigation` component?
<ProjectsNavigation v-model="favoriteProjects" :can-edit-order="false"/>
<ProjectsNavigation :model-value="favoriteProjects" :can-edit-order="false"/>
</nav>
<nav class="menu">
<ProjectsNavigation v-model="projects" :can-edit-order="true"/>
<ProjectsNavigation :model-value="projects" :can-edit-order="true"/>
</nav>
</template>
@ -17,13 +17,8 @@ const projectStore = useProjectStore()
await projectStore.loadProjects()

Call this in App.vue and add a isLoadingPromise that contains the returned promise of the loadProjects function to the projectStore which we then can await here instead.

Call this in `App.vue` and add a `isLoadingPromise` that contains the returned promise of the `loadProjects` 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.

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.

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](https://kolaente.dev/vikunja/frontend/src/commit/74d688b8d20838b2e0dbbe47e04ae0305e48ec6e/src/components/home/contentAuth.vue#L117-L118).

I've now moved it to contentAuth but am using the isLoading property of the project store to show the loading state. That means I can't use the Suspense component, but the loading property already exists and is populated, might as well use it.

I've now moved it to `contentAuth` but am using the `isLoading` property of the project store to show the loading state. That means I can't use the `Suspense` 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 the Suspense, right?

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 the `Suspense`, right?

Yes, I created it only to use it with Suspense. Should I include its contents back into navigation?

Yes, I created it only to use it with `Suspense`. Should I include its contents back into `navigation`?

I think that would be better now. Sry for the back and forth.

I think that would be better now. Sry for the back and forth.

No worries, changed it back.

No worries, changed it back.
const projects = computed({
get() {
return projectStore.notArchivedRootProjects
.sort((a, b) => a.position - b.position)
},
set() { }, // Vue will complain about the component not being writable - but we never need to write here. The setter is only here to silence the warning.
})
const projects = computed(() => projectStore.notArchivedRootProjects
konrad marked this conversation as resolved Outdated

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.

Done

Done
.sort((a, b) => a.position - b.position))
const favoriteProjects = computed(() => projectStore.favoriteProjects
.sort((a, b) => a.position - b.position))
</script>