-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
useTemplateRef warning appears after rollup packaging #12852
Comments
You did not configure the |
Encountered with same warning but in usage of our UI kit. We have a layout component (VDefaultLayoutHeader) with code <script lang="ts" setup>
const refHeader = useTemplateRef('refHeader')
</script>
<template>
<header ref="refHeader" class="v-default-layout-header">
...
</header>
</template> Library is building without problems, but in project where we use this component console display warning message |
@yakudik Please provide a minimal reproduction. |
Thanks for the answer. The same warning happens when I bundle |
@yakudik minimal reproduction with playground, the warning will disappear after changing from DEV to PROD. |
@edison1105 Thanks for your answer. I solved my problem. |
It's true, this warning don't be showed in production, but the main problem is that we use templateRefs not only for VDefaultLayoutHeader. We also have VDataTableTr, for example. This component has two templateRefs (on checkbox and row action) And this component, as you imagine, generate hundreds and hundreds of wirnings during local development) |
<script lang="ts" setup>
-const refHeader = useTemplateRef('refHeader')
+const headerRef = useTemplateRef('refHeader') // use a diff var name is a workaround
</script>
<template>
<header ref="refHeader" class="v-default-layout-header">
...
</header>
</template> |
@edison1105 Is this a bug? Or is it my problem? |
@bee1an this is a bug but an edge case. |
@edison1105 Thank you. I look forward to your fixing it |
<script lang="ts" setup> -const refHeader = useTemplateRef('refHeader') +const headerRef = useTemplateRef('refHeader') // use a diff var name is a workaround </script> ... Yes, and this is my current temporary solution, but i'll of course wait for this problem to be fixed |
Version
3.5.13
Reproduction link
stackblitz.com
Steps to reproduce
When the useTemplateRef argument has the same name as the variable that received it, a console warning appears after using rollup
What is expected?
No warnings
What is actually happening?
[Vue warn] Set operation on key "value" failed: target is readonly.
The text was updated successfully, but these errors were encountered: