100pah commented on code in PR #17349:
URL: https://github.com/apache/echarts/pull/17349#discussion_r920130459


##########
src/chart/custom/CustomView.ts:
##########
@@ -1316,24 +1322,43 @@ function mergeChildren(
     // might be better performance.
     let index = 0;
     for (; index < newLen; index++) {
-        newChildren[index] && doCreateOrUpdateEl(
-            api,
-            el.childAt(index),
-            dataIndex,
-            newChildren[index] as CustomElementOption,
-            seriesModel,
-            el
-        );
+        const newChild = newChildren[index];
+        const oldChild = el.childAt(index);
+        if (newChild) {
+            doCreateOrUpdateEl(
+                api,
+                oldChild,
+                dataIndex,
+                newChild as CustomElementOption,
+                seriesModel,
+                el
+            );
+        }
+        else {
+            removeChildFromGroup(el, oldChild, seriesModel);

Review Comment:
   
   I think at least this behavior is not good (by the current modification): 🤔
   
   old children: `[elA, elB, elC]` (length: 3)
   new children: `[elM, null, elN]` (length: 3)
   
   + if transition animation enabled: 
       + result: `[merge(elA, elM), merge(elC, elN)]` (length: 2, which is 
different from both of the old children and the input new children)
   + if transition animation disabled: 
       + result: `[merge(elA, elM), elC, elN]` (length: 3, but the index of 
`elC` change from `2` to `1` )
   
   Both of them seems not expectable and intuitive for users.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to