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(nuxt): improve warning for invalid children of <Title> #21613

Merged

Conversation

NozomuIkuta
Copy link
Contributor

πŸ”— Linked issue

Resolves #19716

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

I improved a logic to detect wrong usage of Title component.

I tested the following usages in playground:

<Title>Valid</Title>
<Title>{{ 'valid' }}</Title>
<Title>{{ 'valid' }} {{ 'valid' }}</Title>
<Title><p>valid</p></Title>
<!-- Error -->
<Title>
  error due to more than
  <p>2 nodes</p>
</Title>
<Title>
  <!-- Comment is also a vnode -->
  so this is 2nd node
</Title>

We could use VNode's type property to detect redundant p tag and/or preceding comment tag,
but I think it's not a good idea to rely on undocumented APIs.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

I couldn't find the corresponding part of documentation.
If you let me know, I will modify it too.

@danielroe
Copy link
Member

Thank you! ❀️

@danielroe danielroe changed the title chore(nuxt): improve warning for Title component fix(nuxt): improve warning for invalid children of <Title> Jun 17, 2023
@danielroe danielroe merged commit 634829a into nuxt:main Jun 17, 2023
22 checks passed
@github-actions github-actions bot mentioned this pull request Jun 17, 2023
@NozomuIkuta NozomuIkuta deleted the chore/improve-warning-for-title-component branch June 18, 2023 05:52
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.

Head (<Title>) components should validate input better
2 participants