feature/projects-all-the-way-down #3323
|
@ -34,7 +34,7 @@ export const useProjectStore = defineStore('project', () => {
|
|||
.filter(p => p.parentProjectId === 0 && !p.isArchived))
|
||||
const favoriteProjects = computed(() => projectsArray.value
|
||||
.filter(p => !p.isArchived && p.isFavorite))
|
||||
const hasProjects = computed(() => projects.value ? true : false)
|
||||
const hasProjects = computed(() => projectsArray.value.length > 0)
|
||||
|
||||
|
||||
const getChildProjects = computed<IProject[]>(() => {
|
||||
dpschen
commented
This computed seems really unnecessary. Reason: We can achieve the same (and faster) by using:
This computed seems really unnecessary. Reason: We can achieve the same (and faster) by using: `projects.value[id]`. Since `projects` is exported we should replace uses of this computed. We might need to create new simple computeds where used. Depending on usecase something like
```ts
const myProject = computed(() => projects.value[myProjectId.value])
```
konrad
commented
We've actually been using computed for most uses of the store computed anyway. I've changed it to use the We've actually been using computed for most uses of the store computed anyway. I've changed it to use the `projects` property of the store directly.
|
||||
return (id: IProject['id']) => projectsArray.value.filter(p => p.parentProjectId === id)
|
||||
|
|
Reference in New Issue
Block a user
Since
projects
is of type object (defined by its type) this shouldn't work because!!{} === true
.Even if it would be undefined or null sometimes this should use
Boolean(projects.value)
for clarity instead.Afaik there is no way around something like:
Fixed.