Skip to content

Commit

Permalink
fix(editor): fix feed info reset/undo
Browse files Browse the repository at this point in the history
fixes #97
  • Loading branch information
landonreed committed May 5, 2018
1 parent 67e4a83 commit c2df062
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions lib/editor/reducers/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,26 +142,17 @@ const data = (state = defaultState, action) => {
switch (action.component) {
case 'trippattern':
const {tripPatterns} = state.active.entity
patternIndex = tripPatterns.findIndex(p => p.id === action.entity.id)
const pattern = Object.assign({}, tripPatterns[patternIndex])
console.log('reset pattern from', state.active.subEntity, 'to', pattern)
const pattern = clone(tripPatterns.find(p => p.id === action.entity.id))
return update(state, {
active: {
subEntity: {$set: pattern},
patternEdited: {$set: false}
}
})
case 'feedinfo': {
const entity = Object.assign({}, activeTable)
return update(state, {
active: {
entity: {$set: entity},
edited: {$set: false}
}
})
}
default: {
const entity = activeTable.find(e => e.id === action.entity.id)
// NOTE: Finding the entity by ID works for feed_info because feed
// info now (as of SQL editor version) has an ID.
const entity = clone(activeTable.find(e => e.id === action.entity.id))
return update(state, {
active: {
entity: {$set: entity},
Expand Down

0 comments on commit c2df062

Please sign in to comment.