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(find): implement proper find for multi-root components #1116

Merged
merged 1 commit into from Nov 30, 2021

Conversation

xanf
Copy link
Collaborator

@xanf xanf commented Nov 30, 2021

This is the first step to implement proper support for multi-root components.
This will include:

  • ✔️ fixes for find (this PR)
  • fixes for findAll and findAllComponents
  • fixes for .html and .emits

For sake of simplicity this PR is focused solely on fixing find

Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

nice job! This is getting very complex, glad we have a good suite of tests.

return result
} else if (vnode.shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
const children = (vnode.children as unknown as VNodeArrayChildren).flat(
Infinity
Copy link
Member

Choose a reason for hiding this comment

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

Have not seen this flat/Infinity before, neat

const children = (vnode.children as unknown as VNodeArrayChildren).flat(
Infinity
) as VNode[]

Copy link
Member

Choose a reason for hiding this comment

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

Figuring this entire function out must be been complex, nice

@lmiller1990 lmiller1990 merged commit 3ddc17e into master Nov 30, 2021
@lmiller1990 lmiller1990 deleted the improve-find-on-multi-root branch November 30, 2021 22:57
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.

None yet

2 participants