From eafc45a1fd653ce5178aaaf5305b567b4419e394 Mon Sep 17 00:00:00 2001 From: Bart Van Remortele Date: Fri, 16 Apr 2021 12:17:00 +0200 Subject: [PATCH] fix: prevent atom effect from overwriting state when batching set's --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4dc347b..e770323 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,8 +44,8 @@ export const recoilPersist = ( } } - onSet(async (newValue) => { - const state = await getState() + onSet((newValue) => { + const state = getState() if ( newValue !== null && newValue !== undefined &&