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 #1845: add functional component check in component name match #1857

Merged

Conversation

pimlie
Copy link
Contributor

@pimlie pimlie commented Jun 8, 2021

The following PR introduced a bug for finding components that contain a name prop themselves: 3cd81d0#diff-80ab213bfb0eeafc02c6f0005a492f52eab27ef052d46ed9e17c5df0da4eefe1

This PR fixes that behaviour by only using vm.name if the component is functional

This should fix the following issues:
Resolves #1820
Resolves #1845
Resolves #1854

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

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.

Left a comment. Also it looks like the OP in one of the issues posted a reproduction: #1845 (comment), the test is here. Could you verify if this fixes that? If we merge this and mark is as resolving those 3 issues, they'll be closed - we only want to do that if it actually is confirmed to fix those problems.

@@ -0,0 +1,12 @@
<template>
<div>
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a functional component? Since the patch is related to functional component name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the patch is related to functional components but the fix is for normal components.

Eg for a functional component when you access vm.name you will get the name of the component. But accessing vm.name for a normal component will return the name property if that exists. Previously the code was just too greedy by always preferring to use vm.name if it exists. But given the aformentioned that will result in a find bug when you try to find a normal component that has a name prop itself

@pimlie
Copy link
Contributor Author

pimlie commented Jun 13, 2021

This pr indeed fixes 1845:

image

@lmiller1990 lmiller1990 merged commit 21f3ab1 into vuejs:dev Jun 14, 2021
@lmiller1990
Copy link
Member

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