From 3c7733e5b025b0087ae1d25a6aafc7cc7382e0e2 Mon Sep 17 00:00:00 2001 From: Nikolai Giman Date: Sun, 8 Mar 2026 18:11:06 +0100 Subject: [PATCH] fix: lists load for task details --- .../features/tasks/parts/TaskListSelect.vue | 4 +++- web/src/composables/useProjectContext.ts | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/web/src/components/features/tasks/parts/TaskListSelect.vue b/web/src/components/features/tasks/parts/TaskListSelect.vue index 3fd24e4..a30f8a9 100644 --- a/web/src/components/features/tasks/parts/TaskListSelect.vue +++ b/web/src/components/features/tasks/parts/TaskListSelect.vue @@ -68,6 +68,7 @@ import { computed } from 'vue' import { useI18n } from 'vue-i18n' import { useGoalListsStore } from '@/stores/goal-lists.store' import { useTasksStore } from '@/stores/tasks.store' +import { useProjectContext } from '@/composables/useProjectContext' import { ALL_TASKS_LIST_ID } from 'taskview-api' import { useColor } from '@/composables/useColotMode' @@ -79,8 +80,9 @@ const props = defineProps<{ const { t } = useI18n() const goalListsStore = useGoalListsStore() const tasksStore = useTasksStore() +const projectContext = useProjectContext() const { isDark } = useColor() -const lists = computed(() => goalListsStore.lists) +const lists = computed(() => projectContext?.lists.value ?? goalListsStore.lists) const listItems = computed(() => [ { label: t('tasks.noList'), value: ALL_TASKS_LIST_ID }, diff --git a/web/src/composables/useProjectContext.ts b/web/src/composables/useProjectContext.ts index 195cf74..0d86abf 100644 --- a/web/src/composables/useProjectContext.ts +++ b/web/src/composables/useProjectContext.ts @@ -1,10 +1,11 @@ import { ref, computed, watch, provide, inject, type InjectionKey, type Ref, type ComputedRef } from 'vue' -import type { CollaborationResponseFetchAllUsers, KanbanColumnItem } from 'taskview-api' +import type { CollaborationResponseFetchAllUsers, GoalListItem, KanbanColumnItem } from 'taskview-api' import type { TagItem } from '@/types/tags.types' import { DEFAULT_ID } from '@/types/app.types' import { $tvApi } from '@/plugins/axios' import { useTagsStore } from '@/stores/tag.store' import { useGoalsStore } from '@/stores/goals.store' +import { useGoalListsStore } from '@/stores/goal-lists.store' import { useCollaborationStore } from '@/stores/collaboration.store' import { useKanbanStore } from '@/stores/kanban.store' @@ -12,6 +13,7 @@ export type ProjectContext = { tags: ComputedRef users: Ref statuses: Ref + lists: Ref } const PROJECT_CONTEXT_KEY: InjectionKey = Symbol('projectContext') @@ -30,12 +32,14 @@ export function provideProjectContext(goalId: Ref) { const users = ref([]) const statuses = ref([]) + const lists = ref([]) let requestId = 0 watch(goalId, async (id) => { if (id <= 0) { users.value = [] statuses.value = [] + lists.value = [] return } @@ -47,17 +51,20 @@ export function provideProjectContext(goalId: Ref) { if (goalsStore.selectedItemId === id) { const collaborationStore = useCollaborationStore() const kanbanStore = useKanbanStore() + const goalListsStore = useGoalListsStore() users.value = collaborationStore.users statuses.value = kanbanStore.statuses + lists.value = goalListsStore.lists return } // Otherwise fetch project data without touching global stores const currentRequestId = ++requestId - const [usersResult, columnsResult] = await Promise.all([ + const [usersResult, columnsResult, listsResult] = await Promise.all([ $tvApi.collaboration.fetchUsersForGoal(id).catch(() => null), $tvApi.kanban.fetchAllColumns(id).catch(() => null), + $tvApi.goalLists.fetchLists({ goalId: id }).catch(() => null), ]) // Stale check — goalId could have changed while requests were in flight @@ -70,9 +77,10 @@ export function provideProjectContext(goalId: Ref) { ...columnsResult, ] } + if (listsResult) lists.value = listsResult }, { immediate: true }) - const context: ProjectContext = { tags, users, statuses } + const context: ProjectContext = { tags, users, statuses, lists } provide(PROJECT_CONTEXT_KEY, context) return context