useDerived

A value computed from reactive sources, recomputed only when a source changes.

A value computed from reactive sources (subscription snapshots), recomputed only when a source changes, same reference otherwise — the formula layer.

const total = useDerived({ cart: cart ?? [], tax }, ({ cart, tax }) =>
  cart.reduce((s, i) => s + i.price, 0) * (1 + tax))

A derived value that needs the DB is a computed query (server), not this.