You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you open the reproduction you can see that an error is preventing the component from being rendered. The reason for this is that the useTemplateRef is called twice for the same ref. If the second call is commented out the component renders as expected. Switching from prod mode to dev also resolves the issue by just displaying a warning instead.
What is expected?
I'd expect a second call to useTemplateRef for the same ref to behave the same on dev and prod. Ideally calling useTemplateRef twice for the same ref just results in the same object to be returned by both of them.
What is actually happening?
During dev only a warning about the second call to useTemplateRef is logged to the console. Then for the prod build an error is thrown: Cannot redefine property: input.
Any additional comments?
If it's not possible to support calling useTemplateRef twice for the same ref I'd rather have an error during dev already than only a warning. The warning is easy to miss (e.g. in my case the second call was added during rebasing and not caught by CI) and can easily break prod.
The text was updated successfully, but these errors were encountered:
The development environment has already issued a warning message. Perhaps it is necessary to refine the warning message to inform users that the production environment will report an error.
Thanks for the answer, however I think just the warning isn't enough. For example in my case the second call to useTemplateRef was added while rebasing. Afterwards the app wasn't run locally again. So unless there's CI to run some test against the production build such behavior can easily break prod.
That's why I'd rather vote for having the same behavior during dev or some other way to detect this issue without having to run the app and open the dev console. Maybe it would be possible to already catch this issue when building for prod?
Vue version
3.5.13
Link to minimal reproduction
https://play.vuejs.org/#__PROD__eNp9UsFOAjEU/JWXXtAEd4PoBcFEDQc9qEGOTcy6+1gK3bZpuwsJ2X/3tQtIiOHWzkynM6/dsSdjkqZGNmJjl1thPMhMlRPOvOMMHPraPHIlKqOthx3UDudYGZl5nOECWlhYXUGPHHoPXHGVa+U8CGVqP4DJmfyKs8hwdk3iE+ntRSmkKYxvIM+kFKo8j7DQFvwSwWUVgiUgo9TkXYAXhGyElPBjMVvTVWCsLrgap11VKkYbvzejHcC4EE1c0DIGCJY0jX0YSDtV2smC1fE469PM6OKFKJOV04pGugtiznJdGSHRfhgvqDRnI4hM4KiU3rxFzNsa+wc8X2K+/gdfuW3AOPu06NA2yNmR85ktkVIGevr1jltaH8lKF7Uk9QVyhk7LOmTsZM+1Kij2iS6mfY2fgZ5i7qZbj8odSoWgQdlGPWf0K14uVP+LO0zu4jmuWprid4M2eNIAh8l9Mhiy9hdCPuLj
Steps to reproduce
If you open the reproduction you can see that an error is preventing the component from being rendered. The reason for this is that the
useTemplateRef
is called twice for the same ref. If the second call is commented out the component renders as expected. Switching from prod mode to dev also resolves the issue by just displaying a warning instead.What is expected?
I'd expect a second call to useTemplateRef for the same ref to behave the same on dev and prod. Ideally calling
useTemplateRef
twice for the same ref just results in the same object to be returned by both of them.What is actually happening?
During dev only a warning about the second call to
useTemplateRef
is logged to the console. Then for the prod build an error is thrown:Cannot redefine property: input
.Any additional comments?
If it's not possible to support calling useTemplateRef twice for the same ref I'd rather have an error during dev already than only a warning. The warning is easy to miss (e.g. in my case the second call was added during rebasing and not caught by CI) and can easily break prod.
The text was updated successfully, but these errors were encountered: