Skip to content

Commit 3be1073

Browse files
committed
fix: deleting milestones
1 parent ba9f200 commit 3be1073

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/projects/reducers/productsTimelines.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ function updateMilestone(state, productId, milestoneId, dirtyMilestone, shouldRe
6767
if (!state[productId].timeline) return state
6868
const milestoneIdx = _.findIndex(state[productId].timeline.milestones, { id: milestoneId })
6969

70+
// this method could be called during BULK MILESTONE UPDATE during milestone deleting
71+
// so if we cannot find it anymore, don't do anything
72+
if (milestoneIdx === -1) {
73+
return state
74+
}
75+
7076
const updatedMilestone = shouldReplace
7177
? dirtyMilestone
7278
: update(state[productId].timeline.milestones[milestoneIdx], dirtyMilestone)
@@ -160,7 +166,7 @@ export const productsTimelines = (state=initialState, action) => {
160166
case CREATE_TIMELINE_MILESTONE_SUCCESS: {
161167
const {timeline} = action.meta
162168

163-
timeline.milestones = action.payload
169+
timeline.milestones = action.payload
164170

165171
return update(state, {
166172
[timeline.referenceId]: {

0 commit comments

Comments
 (0)