1
0
Fork 0

fix: avoid crashing browser processes during tests

This commit is contained in:
kolaente 2023-05-30 10:42:32 +02:00
parent dbccdb239a
commit 7b05ed9d3d
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import {watch, reactive, shallowReactive, unref, readonly, ref, computed, watchEffect} from 'vue'
import {watch, reactive, shallowReactive, unref, readonly, ref, computed} from 'vue'
import {acceptHMRUpdate, defineStore} from 'pinia'
import {useI18n} from 'vue-i18n'
import {useRouter} from 'vue-router'
@ -44,8 +44,6 @@ 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 => {
@ -72,6 +70,12 @@ export const useProjectStore = defineStore('project', () => {
function setProject(project: IProject) {
projects.value[project.id] = project
update(project)
// FIXME: This should be a watcher, but using a watcher instead will sometimes crash browser processes.
// Reverted from 31b7c1f217532bf388ba95a03f469508bee46f6a
if (baseStore.currentProject?.id === project.id) {
baseStore.setCurrentProject(project)
}
}
function setProjects(newProjects: IProject[]) {