January 19, 2026

State is the only source of truth, not the UI

When UI becomes state, you start debugging pixels instead of logic.

January 12, 2025·1 min read·Caleb Cannon

Judgment: Treat UI as a projection of state, never as the state itself.

The UI is not state. The UI is evidence of state. If you persist UI decisions as state, you will eventually debug screenshots instead of systems.

Mechanism

When a component stores derived UI flags, it can drift from the data it is supposed to describe. Two sources of truth means you now have a consistency problem.

const isEmpty = computed(() => items.value.length === 0)

Derived state belongs in derivations, not in storage. That single change removes an entire category of bugs.

Tradeoffs

Derivation is not free. Complex computations can hurt performance if done in a hot render path. Cache when needed, but treat the cache as disposable. If your cache is the only truth, you are back where you started.

Signal

If you ever ask, “why does the UI say empty when the array is not empty,” you have already paid the price of UI-driven state.