From 856ada6d992bd5f5b6bda5200d97bcb3e74f1ee3 Mon Sep 17 00:00:00 2001 From: Juanfran Date: Tue, 31 Oct 2023 12:35:22 +0100 Subject: [PATCH] fix: i#4082 only edit the current workflow --- .../+state/reducers/kanban.reducer.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/javascript/apps/taiga/src/app/modules/project/feature-kanban/data-access/+state/reducers/kanban.reducer.ts b/javascript/apps/taiga/src/app/modules/project/feature-kanban/data-access/+state/reducers/kanban.reducer.ts index 286ebf0bf..b89b52bb2 100644 --- a/javascript/apps/taiga/src/app/modules/project/feature-kanban/data-access/+state/reducers/kanban.reducer.ts +++ b/javascript/apps/taiga/src/app/modules/project/feature-kanban/data-access/+state/reducers/kanban.reducer.ts @@ -694,7 +694,11 @@ export const reducer = createImmerReducer( on( KanbanApiActions.createStatusSuccess, KanbanEventsActions.updateStatus, - (state, { status }): KanbanState => { + (state, { status, workflow }): KanbanState => { + if (workflow !== state.workflow?.slug) { + return state; + } + state.loadingStatus = false; state.workflow?.statuses.push(status); @@ -706,11 +710,15 @@ export const reducer = createImmerReducer( on( KanbanActions.editStatus, KanbanEventsActions.editStatus, - (state, { status }): KanbanState => { - const statusIndex = state.workflow!.statuses.findIndex( + (state, { status, workflow }): KanbanState => { + if (workflow !== state.workflow?.slug) { + return state; + } + + const statusIndex = state.workflow.statuses.findIndex( (it) => it.id === status.id ); - state.workflow!.statuses[statusIndex].name = status.name; + state.workflow.statuses[statusIndex].name = status.name; return state; } @@ -729,8 +737,12 @@ export const reducer = createImmerReducer( on( KanbanApiActions.deleteStatusSuccess, KanbanEventsActions.statusDeleted, - (state, { status, moveToStatus }): KanbanState => { - const statuses = state.workflow!.statuses; + (state, { status, moveToStatus, workflow }): KanbanState => { + if (workflow !== state.workflow?.slug) { + return state; + } + + const statuses = state.workflow.statuses; const statusIndex = statuses.findIndex((it) => it.id === status); if (moveToStatus) { const storiesToMove = state.stories[status];