Vue · VUE0043

Do not repeat a condition in a v-if / v-else-if chain

Reports a v-else-if branch whose condition repeats, or is fully covered by, earlier conditions in the same v-if / v-else-if chain. Conditions over primitive literals and primitive-literal script setup constants are reported as proven. Conditions that also read script setup refs and shallowRefs initialized with a literal, getter-only computed values, models without get or set options, or props are reported as heuristic-high.
VUE0043vite-doctor/vuetemplatewarnNo fix

Run this rule

pnpm vite-doctor . --framework vue --rules vue/template/no-dupe-v-else-if

Why it matters

Vue renders the first branch of a chain whose condition is truthy. A later branch whose condition can only be truthy when an earlier one already is never renders, which usually hides a copy-paste mistake in the condition.

Change the later condition to the one the branch was meant to test, or remove the branch.

Example

Test a different value in each branch

Before

<script setup>
import { ref } from 'vue'

const status = ref('idle')
</script>

<template>
  <p v-if="status === 'loading'">Loading…</p>
  <p v-else-if="status === 'loading'">Failed</p>
</template>

After

<script setup>
import { ref } from 'vue'

const status = ref('idle')
</script>

<template>
  <p v-if="status === 'loading'">Loading…</p>
  <p v-else-if="status === 'error'">Failed</p>
</template>
Copyright © 2026