1
0

fix: don't set the current project when setting a project

This commit is contained in:
kolaente
2023-04-14 17:41:11 +02:00
parent c30dcff451
commit 31b7c1f217
9 changed files with 17 additions and 19 deletions

View File

@ -1,4 +1,4 @@
import {watch, reactive, shallowReactive, unref, toRefs, readonly, ref, computed} from 'vue'
import {watch, reactive, shallowReactive, unref, toRefs, readonly, ref, computed, watchEffect} from 'vue'
import {acceptHMRUpdate, defineStore} from 'pinia'
import {useI18n} from 'vue-i18n'
import {useRouter} from 'vue-router'
@ -44,6 +44,8 @@ export const useProjectStore = defineStore('project', () => {
return (id: IProject['id']) => projectsArray.value.filter(p => p.parentProjectId === id)
})
watchEffect(() => baseStore.setCurrentProject(projects.value[baseStore.currentProject?.id] || null))
const findProjectByExactname = computed(() => {
return (name: string) => {
const project = Object.values(projects.value).find(l => {
@ -70,10 +72,6 @@ export const useProjectStore = defineStore('project', () => {
function setProject(project: IProject) {
projects.value[project.id] = project
update(project)
if (baseStore.currentProject?.id === project.id) {
baseStore.setCurrentProject(project)
}
}
function setProjects(newProjects: IProject[]) {