From 9a82fda6c8c2e3cbf5c40bebc0f34a0d106f7ad5 Mon Sep 17 00:00:00 2001 From: chnliquan Date: Fri, 15 Jan 2021 11:18:48 +0800 Subject: [PATCH] fix: support strict mode --- src/core/Model.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/Model.tsx b/src/core/Model.tsx index b208db3..3889257 100644 --- a/src/core/Model.tsx +++ b/src/core/Model.tsx @@ -1,4 +1,5 @@ import { useState, useRef, useEffect, Dispatch } from 'react' +import { unstable_batchedUpdates as batchedUpdates} from 'react-dom' import produce from 'immer' import { ConfigReducer, @@ -170,7 +171,7 @@ export class Model { this.devtoolInstance.send(`${this.options.name}/${name}`, state) } - this.container.notify(state) + batchedUpdates(this.container.notify.bind(this.container, state)) } private getReducers(config: C): ContextPropsModel['reducers'] {