-
Notifications
You must be signed in to change notification settings - Fork 264
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: Gracefully handle empty root node for nested component #660
Conversation
Huh, tests failed to run because of styles issues. Do I need to run prettier manually? The run from lint-staged ddidnt see a problem locally, weird. Will see what's wrong later |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Yep, I just run prettier manually.
: this.element.querySelectorAll(selector) | ||
: this.element.querySelectorAll | ||
? this.element.querySelectorAll(selector) | ||
: ([] as unknown as NodeListOf<Element>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is this cast really necessary here? I would have thought that returning a simple array would be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a quick try, and it looks like it's unnecessary. I'll make a PR to remove it. (update: see #662)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad: it was necessary!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, tsd doesn't like it :-P
This PR covers a kind of edge case.
Conditions:
$el
is a comment node)wrapper.findComponent(Component)
extractedWrapper.find()
orExtractedWrapper.findAll()
This will fail with an error being thrown:
This PR handles this case in a graceful way.