-
-
Notifications
You must be signed in to change notification settings - Fork 9k
dx(runtime-core): check current and parent components in formatComponentName #7220
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
Conversation
Size ReportBundles
Usages
|
# Conflicts: # packages/runtime-core/src/component.ts
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
|
The failure of |
WalkthroughThis PR enhances component name inference in Vue's runtime-core by introducing comprehensive tests for the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)packages/runtime-core/__tests__/component.spec.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
formatComponentName()already checks thecomponentsoption for both the current component and the parent component, searching for the component name. However, the current logic will only search the parent if the current component doesn't have acomponentsoption.The following example intentionally logs a warning, but in the warning message the name
Anonymousis used, rather thanMyChild. If the redundantcomponents: {}option is removed, the warning successfully identifies the name of the component.https://jsfiddle.net/skirtle/abnvzju0/
This PR changes the logic in
formatComponentName()so that the parent will still be checked even if the child has acomponentsoption of its own, assuming the component's name hasn't already been found.The PR also includes:
formatComponentName().formatComponentName()for a warning elsewhere in the same file.instance.parentcheck has been moved so that it is only applied in the code branch that needsinstance.parent.Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.