From 6deba2b1cc49d9ae46f06cc544a0f87fc87a32ff Mon Sep 17 00:00:00 2001 From: Mingfei Date: Fri, 24 Sep 2021 16:45:48 +0800 Subject: [PATCH] fix: add remove component in one frame throw error (#145) --- packages/eva.js/lib/core/ComponentObserver.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/eva.js/lib/core/ComponentObserver.ts b/packages/eva.js/lib/core/ComponentObserver.ts index f993f366..44e64b49 100644 --- a/packages/eva.js/lib/core/ComponentObserver.ts +++ b/packages/eva.js/lib/core/ComponentObserver.ts @@ -39,6 +39,9 @@ class ComponentObserver { */ add({ component, prop, type, componentName }: ObserverEventParams) { if (type === ObserverType.REMOVE) { + if (this.events.find((changed: ObserverEvent) => changed.component === component && changed.type === ObserverType.ADD)) { + return + } this.events = this.events.filter(changed => changed.component !== component); }