[Bug] Variable's in-template usage not detected
See original GitHub issueIn the following scenario, the CurrentYear
variable doesn’t get picked up.
<i18n>
{
"en": {
"copyrightNotice": "{currentYear} (...)"
}
}
</i18n>
<template>
<span>
{{ $t("copyrightNotice", { currentYear: CurrentYear }) }}
</span>
</template>
<script setup lang="ts">
import { computed, useContext } from "@nuxtjs/composition-api";
const { $moment } = useContext();
const CurrentYear = computed(() => $moment().year());
</script>
It does work though when variable is present in the following way:
<template>
<span>
{{ CurrentYear }}
</span>
</template>
Is there some background optimisation in place detecting unused variables and ignoring them? If so, unfortunately this is a case when it appears to fail.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Why template local variables are not usable ... - Stack Overflow
My goal is to focus an element that will be created. Solution given by Mark Rajcok: make a directive with an afterViewInit that...
Read more >clion does not see usages of data variable for template class
This is small example, I have a template class which declared in ". h" file, and the implementation of its function is in...
Read more >'recursive loop detected in template string' error with variables ...
I've found a weird bug with ansible playbooks (or maybe my code/setup). When I use a tasks playbook using an include, the variables...
Read more >Typing $ to create or list template variables does not work - Jira
The problem isn't creating new variables. It's the inability to use/insert that variable in the rest of the page. Andrew W.
Read more >Troubleshooting email template error messages – Klaviyo
This error message means one or more of your variables contains a filter that has been applied incorrectly. Compare your filters to those...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Definitely, I will share a reproduction as soon as I get meaningful results. I was overconfident with the above snippets - when I attempted to reproduce the problem myself in a blank project, I couldn’t do that in any way. Turns out to be more tricky than I thought. Whenever I have some spare time, I will try to replicate my current project step-by-step and see which bit of code (or library) triggers the bug. Very bizarre. I am intrigued what makes it skip the variable so I will keep digging!
@DamianGlowala I’m trying to rewrite parseSFC logic. It will take some time.