Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 duplicated icons when Tree showLine is true #20102

Merged
merged 1 commit into from
Dec 5, 2019
Merged

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Dec 5, 2019

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close #20090

💡 Background and solution

      <Tree showIcon showLine defaultExpandedKeys={['0-0-0']} onSelect={this.onSelect}>
        <TreeNode title="parent 1" key="0-0">
          <TreeNode icon={<Icon type="form" />} title="parent 1-0" key="0-0-0">
            <TreeNode icon={<Icon type="form" />} title="leaf" key="0-0-0-0" />
            <TreeNode title="leaf" key="0-0-0-1" />
            <TreeNode title="leaf" key="0-0-0-2" />
          </TreeNode>
          <TreeNode title="parent 1-1" key="0-0-1">
            <TreeNode title="leaf" key="0-0-1-0" />
          </TreeNode>
          <TreeNode title="parent 1-2" key="0-0-2">
            <TreeNode title="leaf" key="0-0-2-0" />
            <TreeNode title="leaf" key="0-0-2-1" />
          </TreeNode>
        </TreeNode>
      </Tree>

image

fixed to

image

📝 Changelog

Language Changelog
🇺🇸 English Fix Tree duplicated icons when showLine is true.
🇨🇳 Chinese 修复 Tree showLinetrue 时展示多余图标的问题。

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests to make sure this change works as expected?

@netlify
Copy link

netlify bot commented Dec 5, 2019

Deploy preview for ant-design ready!

Built with commit b61a108

https://deploy-preview-20102--ant-design.netlify.com

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 5, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ccf13db950ac743530a61db1d74f8cd7eaca7f44:

Sandbox Source
antd reproduction template Configuration

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 5, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b61a108:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

codecov bot commented Dec 5, 2019

Codecov Report

Merging #20102 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20102      +/-   ##
==========================================
+ Coverage   97.81%   97.81%   +<.01%     
==========================================
  Files         286      286              
  Lines        7737     7739       +2     
  Branches     2128     2177      +49     
==========================================
+ Hits         7568     7570       +2     
  Misses        169      169
Impacted Files Coverage Δ
components/tree/Tree.tsx 97.05% <100%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8fda397...b61a108. Read the comment docs.

@afc163 afc163 merged commit 4146efa into master Dec 5, 2019
@afc163 afc163 deleted the fix-tree-icon branch December 5, 2019 09:48
@@ -239,6 +239,9 @@ export default class Tree extends React.Component<TreeProps, any> {
<RcTree
ref={this.setTreeRef}
{...props}
// Hide icon in node when showLine is true, show icon in line always
// https://github.com/ant-design/ant-design/issues/20090
showIcon={showLine ? false : showIcon}
prefixCls={prefixCls}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showLine ? false : showIcon === false

@afc163
Copy link
Member Author

afc163 commented Dec 11, 2019

cause #20192 and fixed in #20196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TreeNode 设置自定义 icon 后还显示默认的图标
2 participants