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(comp:transfer): empty suffix node shouldn't be rendered #1267

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

sallerli1
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

slot渲染的空suffix(包含Fragment、Comment、或者空数组等),没有被判空导致渲染了空的suffix节点占位置

What is the new behavior?

修复以上问题

Other information

@idux-bot
Copy link

idux-bot bot commented Nov 10, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Merging #1267 (7ab2ed3) into main (99e4ddd) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 7ab2ed3 differs from pull request most recent head f8c406a. Consider uploading reports for the commit f8c406a to get more accurate results

@@           Coverage Diff           @@
##             main    #1267   +/-   ##
=======================================
  Coverage   93.05%   93.05%           
=======================================
  Files         320      320           
  Lines       29469    29476    +7     
  Branches     3344     3348    +4     
=======================================
+ Hits        27422    27430    +8     
+ Misses       2047     2046    -1     
Impacted Files Coverage Δ
packages/cdk/utils/src/vNode.ts 96.70% <100.00%> (+1.30%) ⬆️
packages/components/tree/src/Tree.tsx 95.13% <0.00%> (+0.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

packages/cdk/utils/src/vNode.ts Outdated Show resolved Hide resolved
@@ -142,7 +140,11 @@ export default defineComponent({
const renderSuffix = (prefixCls: string) => {
const suffix = slots.headerSuffix?.({ isSource: props.isSource })

return suffix && <span class={`${prefixCls}-suffix`}>{suffix}</span>
if (isEmptyNode(suffix)) {
Copy link
Member

Choose a reason for hiding this comment

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

使用了 suffix 插槽,如果还是返回一个空节点,这种情况组件库要处理的话,就太多的地方都需要处理。
我个人建议是业务线自己特殊处理下。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个和其他的插槽不太一样,已选和待选的两个框的后缀是同一个插槽负责渲染的,模板渲染用v-if的话没有办法返回空。组件样式上也没办法很好兼容这种情况,让用户自己写样式处理这个问题感觉不太合理

@danranVm danranVm merged commit 4ab1ebb into IDuxFE:main Nov 15, 2022
@sallerli1 sallerli1 deleted the fix-transfer-suffix-slot branch February 20, 2023 06:11
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.

2 participants