From f22be1926d17257705857b01e8dc534f741dfe93 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Mon, 1 Aug 2022 10:56:11 +0800 Subject: [PATCH 1/3] fix(custom): set ignore only if old child exists --- src/chart/custom/CustomView.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chart/custom/CustomView.ts b/src/chart/custom/CustomView.ts index 215087b72b..1b67dc7d9e 100644 --- a/src/chart/custom/CustomView.ts +++ b/src/chart/custom/CustomView.ts @@ -1339,7 +1339,7 @@ function mergeChildren( el ); } - else { + else if (oldChild) { // If the new element option is null, it means to remove the old // element. But we cannot really remove the element from the group // directly, because the element order may not be stable when this From 1eb1394c894666658676d0319ae04aab1662036c Mon Sep 17 00:00:00 2001 From: Ovilia Date: Mon, 1 Aug 2022 14:24:26 +0800 Subject: [PATCH 2/3] fix(custom): add assert to give more detailed information --- src/chart/custom/CustomView.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chart/custom/CustomView.ts b/src/chart/custom/CustomView.ts index 1b67dc7d9e..cd1e37cc8a 100644 --- a/src/chart/custom/CustomView.ts +++ b/src/chart/custom/CustomView.ts @@ -1339,7 +1339,10 @@ function mergeChildren( el ); } - else if (oldChild) { + else { + if (__DEV__) { + assert(oldChild, 'renderItem should not return a group containing elements as null/undefined/{} if they do not exist before.'); + } // If the new element option is null, it means to remove the old // element. But we cannot really remove the element from the group // directly, because the element order may not be stable when this From 68e8fc38a97cf4b35e3181bb2f16cbbb1abc6a70 Mon Sep 17 00:00:00 2001 From: Ovilia Date: Mon, 1 Aug 2022 14:27:07 +0800 Subject: [PATCH 3/3] style(custom): new line --- src/chart/custom/CustomView.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/chart/custom/CustomView.ts b/src/chart/custom/CustomView.ts index cd1e37cc8a..ad282ed9b0 100644 --- a/src/chart/custom/CustomView.ts +++ b/src/chart/custom/CustomView.ts @@ -1341,7 +1341,11 @@ function mergeChildren( } else { if (__DEV__) { - assert(oldChild, 'renderItem should not return a group containing elements as null/undefined/{} if they do not exist before.'); + assert( + oldChild, + 'renderItem should not return a group containing elements' + + ' as null/undefined/{} if they do not exist before.' + ); } // If the new element option is null, it means to remove the old // element. But we cannot really remove the element from the group