Skip to content

Commit 347dd47

Browse files
committed
Remove references to confusing second updateCard action
There are some bugs associated with the removed updateCard that cause changes to be wiped out. This change uses the working updateCard function and also allows us to keep the event bus UPDATE_CARD signature the same.
1 parent 1cf8fd4 commit 347dd47

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

src/controllers/Lane.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class Lane extends Component {
142142
}
143143

144144
updateCard = updatedCard => {
145-
this.props.actions.updateCard({laneId: this.props.id, updatedCard})
145+
this.props.actions.updateCard({laneId: this.props.id, card: updatedCard})
146146
this.props.onCardUpdate(this.props.id, updatedCard)
147147
}
148148

src/helpers/LaneHelper.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,6 @@ const LaneHelper = {
6868
return update(state, {lanes: {$set: lanes}})
6969
},
7070

71-
updateCardFromLane: (state, {laneId, card}) => {
72-
const laneIndex = state.lanes.findIndex(x => x.id === laneId)
73-
if (laneIndex < 0) {
74-
return state
75-
}
76-
const cardIndex = state.lanes[laneIndex].cards.findIndex(x => x.id === card.id)
77-
if (cardIndex < 0) {
78-
return state
79-
}
80-
return update(state, {
81-
lanes: {
82-
[laneIndex]: {
83-
cards: {
84-
[cardIndex]: {
85-
$set: card
86-
}
87-
}
88-
}
89-
}
90-
})
91-
},
92-
9371
moveCardAcrossLanes: (state, {fromLaneId, toLaneId, cardId, index}) => {
9472
let cardToMove = null
9573
const interimLanes = state.lanes.map(lane => {
@@ -116,7 +94,7 @@ const LaneHelper = {
11694
return update(state, {lanes: {$set: lanes}})
11795
},
11896

119-
updateCardForLane: (state, {laneId, updatedCard}) => {
97+
updateCardForLane: (state, {laneId, card: updatedCard}) => {
12098
const lanes = state.lanes.map(lane => {
12199
if (lane.id === laneId) {
122100
const cards = lane.cards.map(card => {

src/reducers/BoardReducer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const boardReducer = (state = {lanes: []}, action) => {
77
return Lh.initialiseLanes(state, payload)
88
case 'ADD_CARD':
99
return Lh.appendCardToLane(state, payload)
10-
case 'UPDATE_CARD':
11-
return Lh.updateCardFromLane(state, payload)
1210
case 'REMOVE_CARD':
1311
return Lh.removeCardFromLane(state, payload)
1412
case 'MOVE_CARD':

0 commit comments

Comments
 (0)