Vue · Reactivity
vite-doctor/vuereactivityerrorNo fix
Why it happens
Computed getters are lazy and cached, so side effects inside them run at unpredictable times, .sort() and `.`reverse() reorder the source array in place, and an async getter makes the computed value a Promise instead of the data.
Fix
Keep the getter pure and synchronous: sort a copy, move writes and timers into a watcher or event handler, and load async data into a ref that the computed reads.
Example
Sort a copy inside computed
Before
<script setup lang="ts">
const items = ref([3, 1, 2])
const sorted = computed(() => items.value.sort())
</script>
After
<script setup lang="ts">
const items = ref([3, 1, 2])
const sorted = computed(() => items.value.toSorted())
</script>
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --framework vue --rules vue/reactivity/no-computed-side-effects