Skip to content

Commit

Permalink
fix(gtfsplus): fix rowIndex for new row in new table (0-based, not 1-…
Browse files Browse the repository at this point in the history
…based)
  • Loading branch information
landonreed committed Oct 4, 2017
1 parent 621c62a commit 051a50e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/gtfsplus/reducers/gtfsplus.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const gtfsplus = (state = defaultState, action) => {
// add rowIndex for use with tracking row for deletion/updating values
newRow.rowIndex = tableExists
? state.tableData[state.activeTableId].length
: 1
: 0
// create this table if it doesn't already exist
if (!tableExists) {
return update(state,
Expand Down Expand Up @@ -110,7 +110,6 @@ const gtfsplus = (state = defaultState, action) => {
const deleteTable = state.tableData[action.tableId]
// update rowIndex for rows after deleted row (to account for index offset)
const recordsAfterDeletedRow = deleteTable.slice(action.rowIndex + 1)
console.log(recordsAfterDeletedRow)
recordsAfterDeletedRow.map(r => {
r.rowIndex = r.rowIndex - 1
})
Expand Down

0 comments on commit 051a50e

Please sign in to comment.