Skip to content

Potentially Confusing Double Template Refs #13020

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

Closed
Disservin opened this issue Mar 10, 2025 · 0 comments
Closed

Potentially Confusing Double Template Refs #13020

Disservin opened this issue Mar 10, 2025 · 0 comments

Comments

@Disservin
Copy link
Contributor

Disservin commented Mar 10, 2025

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9kj1PwzAQhv/KyUtbqTQDTCVFAtQBBkClo5cqvRQXx7b8ESpF+e+cnbaEqsp2vvc557nIDXs0ZlYHZHOWu8IK48GhD+aBK1EZbT00EByusTJy43GF5RQsltBCaXUFIxod3XPFVaGV8yCUCZ4gWFxMjTlLGWcTwnswkXTfeMJVnnUC9Gk6+OMsnQDyrahT8a8EaJp0R9ses2yYI4+raCdCGouzJdQ3ld6i7HWyTuU4mGc9QzZl3tFSpdjN9k4r+ptNhDkrdGWERPtuvKClOZtDSmK2kVL/vKaetwGnp37xhcX3lf7eHWKPsw+LDm2NnJ0zv7E7JMsYLz/f8ED1OaRNgiR6IFyh0zJExw57CmpL2j0u2b6kNyHUbu2WB4/KnZaKopFsE88ZvYvngdX/dG9nd2mOq5a1v7t717o=

Steps to reproduce

There are two template refs available to the input.

What is expected?

While technically being correct, the code example from the playground is probably not what the (new) user intended.

New users will probably start using useTemplateRef and may fall into the trap of defining another ref with a name which is equal to the ref on the HTML Input element. This is confusing, and I think this usage was removed from the docs as well (not sure).

It would be better if the compiler would catch this case and issue a warning for last template ref, suggesting to rename/remove it.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants