chore: export projects as array directly from projects store
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2023-03-28 15:36:31 +02:00
parent 39b076ef6b
commit 51f2ffc2c2
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 5 additions and 4 deletions

View File

@ -79,10 +79,10 @@ onBeforeMount(async () => {
await projectStore.loadProjects()
})
const projects = computed(() => Object.values(projectStore.projects)
const projects = computed(() => projectStore.projectsArray
.filter(p => p.parentProjectId === 0 && !p.isArchived)
.sort((a, b) => a.position < b.position ? -1 : 1))
const favoriteProjects = computed(() => Object.values(projectStore.projects)
const favoriteProjects = computed(() => projectStore.projectsArray
.filter(p => !p.isArchived && p.isFavorite)
.map(p => ({
...p,

View File

@ -28,7 +28,7 @@ export const useProjectStore = defineStore('project', () => {
// The projects are stored as an object which has the project ids as keys.
const projects = ref<ProjectState>({})
const projectsArray = computed(() => Object.values(projects.value))
const getProjectById = computed(() => {
return (id: IProject['id']) => typeof projects.value[id] !== 'undefined' ? projects.value[id] : null
@ -180,6 +180,7 @@ export const useProjectStore = defineStore('project', () => {
return {
isLoading: readonly(isLoading),
projects: readonly(projects),
projectsArray: readonly(projectsArray),
getProjectById,
findProjectByExactname,

View File

@ -91,7 +91,7 @@ const showArchived = useStorage('showArchived', false)
const loading = computed(() => projectStore.isLoading)
const projects = computed(() => {
return Object.values(projectStore.projects).filter(project => showArchived.value
return projectStore.projectsArray.filter(project => showArchived.value
? true
: !project.isArchived,
)