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: overlay): first vnode is comment node #1116

Merged
merged 1 commit into from
Sep 5, 2022

Conversation

threedayAAAAA
Copy link
Contributor

@threedayAAAAA threedayAAAAA commented Sep 4, 2022

fix: #1098

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?

overlay 插槽中首个节点是注释节点时 组件不能正常渲染

What is the new behavior?

overlay 插槽中首个节点是注释节点时 组件可以正常渲染

Other information

@idux-bot
Copy link

idux-bot bot commented Sep 4, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Sep 4, 2022

Codecov Report

Merging #1116 (89029b7) into main (84e8e17) will increase coverage by 3.45%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1116      +/-   ##
==========================================
+ Coverage   93.46%   96.92%   +3.45%     
==========================================
  Files         657      321     -336     
  Lines       65008    30625   -34383     
  Branches     7822     2807    -5015     
==========================================
- Hits        60760    29683   -31077     
+ Misses       4248      942    -3306     
Impacted Files Coverage Δ
packages/cdk/utils/src/vNode.ts 95.74% <100.00%> (+0.04%) ⬆️
packages/cdk/forms/src/utils.ts 75.44% <0.00%> (-19.64%) ⬇️
packages/components/time-picker/src/utils.ts 37.14% <0.00%> (-15.24%) ⬇️
packages/components/utils/src/convertTarget.ts 85.71% <0.00%> (-14.29%) ⬇️
packages/cdk/click-outside/src/useClickOutside.ts 81.81% <0.00%> (-13.78%) ⬇️
packages/pro/transfer/src/utils.ts 85.71% <0.00%> (-12.57%) ⬇️
packages/cdk/utils/src/dom.ts 75.32% <0.00%> (-10.97%) ⬇️
packages/components/input/src/useInput.ts 92.19% <0.00%> (-7.81%) ⬇️
packages/cdk/scroll/src/utils.ts 79.60% <0.00%> (-4.17%) ⬇️
packages/components/slider/src/useSlider.ts 60.05% <0.00%> (-3.74%) ⬇️
... and 572 more

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

@@ -37,13 +37,14 @@ function getChildren(node: VNode, depth: number): VNode | undefined {
* @param maxDepth depth to be searched, default is 3
*/
export function getFirstValidNode(nodes: VNodeChild, maxDepth = 3): VNode | undefined {
if (isNil(nodes) || (Array.isArray(nodes) && !nodes.length)) {
const targetNodes = Array.isArray(nodes) ? nodes.filter(item => !isComment(item)) : nodes
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const targetNodes = Array.isArray(nodes) ? nodes.filter(item => !isComment(item)) : nodes
const targetNodes = Array.isArray(nodes) ? nodes.filter(item => !getChildren(item, maxDepth)) : nodes

这里同样需要过滤掉其他的节点。

Copy link
Member

Choose a reason for hiding this comment

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

我先合并吧,这里我需要重构一下。

@danranVm danranVm merged commit d0d1e8e into IDuxFE:main Sep 5, 2022
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.

[comp:popover] pop组件首个节点为注释节点时无法正常渲染
2 participants