You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/05/10 09:30:53 UTC

[GitHub] [echarts] Map1en opened a new pull request #14905: fix(tree): error when running setOption twice with diff data

Map1en opened a new pull request #14905:
URL: https://github.com/apache/echarts/pull/14905


   
   
   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [x] bug fixing
   - [ ] new feature
   - [ ] others
   
   
   
   ### What does this PR do?
   
   <!-- USE ONCE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
   
   Fixed the bug of running setOption twice in tree chart with different data
   
   ### Fixed issues
   
   close #14858
   <!--
   - #xxxx: ...
   -->
   
   
   ## Details
   
   ### Before: What was the problem?
   Tree chart error when running setOption twice with different data
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ### After: How is it fixed in this PR?
   
   Using optional chains
   
   And add one visual test
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ## Misc
   
   <!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
   
   - [ ] The API has been changed (apache/echarts-doc#xxx).
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   test/tree-setoption-twice.html
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merge.
   
   ### Other information
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] pissang commented on a change in pull request #14905: fix(tree): error when running setOption twice with diff data

Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #14905:
URL: https://github.com/apache/echarts/pull/14905#discussion_r630961408



##########
File path: src/chart/tree/TreeSeries.ts
##########
@@ -149,7 +149,7 @@ class TreeSeriesModel extends SeriesModel<TreeSeriesOption> {
         function beforeLink(nodeData: List) {
             nodeData.wrapMethod('getItemModel', function (model, idx) {
                 const node = tree.getNodeByDataIndex(idx);
-                if (!node.children.length || !node.isExpand) {
+                if (!node?.children.length || !node.isExpand) {

Review comment:
       We avoid using optional chaining in our code because it is easy to generate lots of unnecessary code after compiled.
   ```ts
   if (!(node && node.children.length && node.isExpand))
   ``` 
    will be much simpler here.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] echarts-bot[bot] commented on pull request #14905: fix(tree): error when running setOption twice with diff data

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #14905:
URL: https://github.com/apache/echarts/pull/14905#issuecomment-836463998


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] echarts-bot[bot] commented on pull request #14905: fix(tree): error when running setOption twice with diff data

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #14905:
URL: https://github.com/apache/echarts/pull/14905#issuecomment-840183098


   Congratulations! Your PR has been merged. Thanks for your contribution! 👍


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] pissang merged pull request #14905: fix(tree): error when running setOption twice with diff data

Posted by GitBox <gi...@apache.org>.
pissang merged pull request #14905:
URL: https://github.com/apache/echarts/pull/14905


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org