remove unintended change from default merge behaviour to identical but manual one (#2661)

targeted section of the README talks about integration with redux devtools. to accomplish this the dev needs to define third argument for `set` function. since arguments for `set` function are positional it means he/she needs to define the second, `replace`, argument as well

currently README suggests just to use `false` value for `replace` arg i.e. to override the default value by identical manual one, but defined on the dev side.

more clean way would be to use `undefined` at the second argument position that will make JS to use the default value, that is defined by lib authors, not dev
This commit is contained in:
Mordechai Dror 2024-08-04 09:50:16 +03:00 committed by GitHub
parent 66f3a029fb
commit 7c14615815
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -401,7 +401,7 @@ const useBearStore = create(devtools((set) => ({
...
eatFish: () => set(
(prev) => ({ fishes: prev.fishes > 1 ? prev.fishes - 1 : 0 }),
false,
undefined,
'bear/eatFish'
),
...
@ -413,7 +413,7 @@ You can also log the action's type along with its payload:
...
addFishes: (count) => set(
(prev) => ({ fishes: prev.fishes + count }),
false,
undefined,
{ type: 'bear/addFishes', count, }
),
...