esamattis / esamattis/immer-reducer

Duplicate Reducer Method Invokation

Open
#53 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
223
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hey there! I'm reporting a bug that seems to have also appeared in `use-immer`.

When invoking a reducer function, it fires twice initially, but it appears that it does not modify the state twice.

I've reproduced it in CodeSandbox: https://codesandbox.io/s/immer-reducer-duplicate-invokation-iylwj

`use-immer` Issue: https://github.com/immerjs/use-immer/issues/11

The solution seemed to have something to do with the need to memo a `produce()`'d reducer, or something along those lines.

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.