Fix CRUDReducer bug when retrieving item that already exists
This commit is contained in:
parent
a81a68b6e2
commit
363b84699f
@ -115,10 +115,14 @@ export class CRUDReducer<
|
||||
}
|
||||
|
||||
handleFindOne = (state: ICRUDState<T>, payload: T): ICRUDState<T> => {
|
||||
const ids = !state.byId[payload.id]
|
||||
? [...state.ids, payload.id]
|
||||
: state.ids
|
||||
return {
|
||||
...state,
|
||||
ids: [...state.ids, payload.id],
|
||||
ids,
|
||||
byId: {
|
||||
...state.byId,
|
||||
[payload.id]: payload,
|
||||
},
|
||||
status: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user