Skip to content

Commit

Permalink
fix: immer return value
Browse files Browse the repository at this point in the history
  • Loading branch information
chnliquan committed Apr 14, 2021
1 parent 5833681 commit f3b3005
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion docs/demos/counter/hooks/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ export const counter = createModel<RootModel, 'counter'>()({
},
}),
})

2 changes: 1 addition & 1 deletion src/core/Model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class Model<C extends ModelConfig> {

if (typeof state === 'object') {
newState = produce(state, draft => {
reducer(draft, ...payload)
return reducer(draft, ...payload)
})
} else {
newState = reducer(state, ...payload)
Expand Down

0 comments on commit f3b3005

Please sign in to comment.