Skip to content

Commit

Permalink
Merge pull request #4233 from appirio-tech/hotfix/milestone-delete
Browse files Browse the repository at this point in the history
[HOTFIX] [PROD] Milestone delete
  • Loading branch information
RishiRajSahu authored Dec 29, 2020
2 parents ba9f200 + 3be1073 commit 961dca7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/projects/reducers/productsTimelines.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ function updateMilestone(state, productId, milestoneId, dirtyMilestone, shouldRe
if (!state[productId].timeline) return state
const milestoneIdx = _.findIndex(state[productId].timeline.milestones, { id: milestoneId })

// this method could be called during BULK MILESTONE UPDATE during milestone deleting
// so if we cannot find it anymore, don't do anything
if (milestoneIdx === -1) {
return state
}

const updatedMilestone = shouldReplace
? dirtyMilestone
: update(state[productId].timeline.milestones[milestoneIdx], dirtyMilestone)
Expand Down Expand Up @@ -160,7 +166,7 @@ export const productsTimelines = (state=initialState, action) => {
case CREATE_TIMELINE_MILESTONE_SUCCESS: {
const {timeline} = action.meta

timeline.milestones = action.payload
timeline.milestones = action.payload

return update(state, {
[timeline.referenceId]: {
Expand Down

0 comments on commit 961dca7

Please sign in to comment.