Skip to content

Commit

Permalink
fix(tickets): incorrect tickets removed from ticket view
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Mar 1, 2022
1 parent ae896ee commit a943497
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/client/reducers/ticketsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ const reducer = handleActions(

[DELETE_TICKET.SUCCESS]: (state, action) => {
const idx = state.tickets.findIndex(ticket => {
return ticket.get('_id') === action.payload.id
return ticket.get('_id').toString() === action.payload.id.toString()
})

if (idx === -1) return { ...state }

return {
...state,
tickets: state.tickets.delete(idx)
Expand All @@ -150,8 +152,10 @@ const reducer = handleActions(
case 'deleted': {
const id = action.payload.data
const idx = state.tickets.findIndex(ticket => {
return ticket.get('_id') === id
return ticket.get('_id').toString() === id.toString()
})
if (idx === -1) return { ...state }

return {
...state,
tickets: state.tickets.delete(idx)
Expand Down

0 comments on commit a943497

Please sign in to comment.