import { computed, reactive, ref } from "vue"; const count = ref(1); const doubled = computed(() => count.value * 2); const before = doubled.value; const cached = doubled.value === before; const state = reactive({ items: [] as number[] }); const total = computed(() => state.items.reduce((sum, item) => sum + item, 0)); state.items.push(2, 3); count.value = 5; const after = doubled.value; let evaluations = 0; const tracked = computed(() => { evaluations += 1; return count.value + 1; }); void tracked.value; void tracked.value; const readsCached = evaluations === 1; count.value = 6; void tracked.value; const recomputed = evaluations === 2; console.log( JSON.stringify({ evt: "smoke", ok: before === 2 && cached && after === 10 && total.value === 5 && readsCached && recomputed, before, after, total: total.value, evaluations, readsCached, recomputed, }), );