From 4e239c87ef0b6ffa665d8f7f30cf53b7457a8ac7 Mon Sep 17 00:00:00 2001 From: Mordechai Dror Date: Fri, 2 Aug 2024 16:15:09 +0300 Subject: [PATCH] remove unintended change from default merge behaviour to identical but manual one 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 --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 7a0eacea3c..274a4bd8f7 100644 --- a/readme.md +++ b/readme.md @@ -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, } ), ...