Commit 4ef0dd4e authored by Rajat Jain's avatar Rajat Jain

Fix swimlanes duplicate epics

Unite them by using `epic.id`
parent f882fef9
import Vue from 'vue';
import { union } from 'lodash';
import { union, unionBy } from 'lodash';
import mutationsCE, { addIssueToList, removeIssueFromList } from '~/boards/stores/mutations';
import { moveIssueListHelper } from '~/boards/boards_util';
import { s__ } from '~/locale';
......@@ -130,7 +130,7 @@ export default {
},
[mutationTypes.RECEIVE_EPICS_SUCCESS]: (state, epics) => {
Vue.set(state, 'epics', union(state.epics || [], epics));
Vue.set(state, 'epics', unionBy(state.epics || [], epics, 'id'));
},
[mutationTypes.RESET_EPICS]: state => {
......
---
title: Fix swimlanes duplicate epics
merge_request: 44728
author:
type: fixed
......@@ -232,6 +232,17 @@ describe('RECEIVE_EPICS_SUCCESS', () => {
expect(state.epics).toEqual(mockEpics);
});
it("doesn't add duplicate epics", () => {
state = {
...state,
epics: mockEpics,
};
mutations.RECEIVE_EPICS_SUCCESS(state, mockEpics);
expect(state.epics).toEqual(mockEpics);
});
});
describe('RESET_EPICS', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment