Skip to content

Commit

Permalink
fix: add remove component in one frame throw error (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanmingfei authored Sep 24, 2021
1 parent e8b82d9 commit 6deba2b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/eva.js/lib/core/ComponentObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6deba2b

Please sign in to comment.