mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-02-01 22:47:40 +00:00
fix: resolve readonly project type issue in AppHeader.vue
Create mutable copy of currentProject from Pinia store to satisfy type requirements. The readonly deep object from the store has readonly tasks array which is incompatible with IProject type. Fixes TypeScript errors on lines 25 and 40 where readonly project was passed to getProjectTitle() and ProjectSettingsDropdown component. Related to issue #29 from TYPECHECK_ISSUES.md
This commit is contained in:
@@ -133,9 +133,14 @@ import { isEditorContentEmpty } from '@/helpers/editorContentEmpty'
|
||||
import { useBaseStore } from '@/stores/base'
|
||||
import { useConfigStore } from '@/stores/config'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import type { IProject } from '@/modelTypes/IProject'
|
||||
|
||||
const baseStore = useBaseStore()
|
||||
const currentProject = computed(() => baseStore.currentProject)
|
||||
// Create a mutable copy to satisfy type requirements (readonly deep -> mutable)
|
||||
const currentProject = computed<IProject | null>(() => {
|
||||
const project = baseStore.currentProject
|
||||
return project ? { ...project } as IProject : null
|
||||
})
|
||||
const background = computed(() => baseStore.background)
|
||||
const canWriteCurrentProject = computed(() => baseStore.currentProject?.maxPermission !== null && baseStore.currentProject?.maxPermission !== undefined && baseStore.currentProject.maxPermission > Permissions.READ)
|
||||
const menuActive = computed(() => baseStore.menuActive)
|
||||
|
||||
Reference in New Issue
Block a user