Components follow single-responsibility principle
Why it matters
A component that fetches data, transforms it, manages multiple unrelated state slices, and renders three distinct UI panels cannot be tested in isolation, reused elsewhere, or modified safely. ISO 25010 maintainability.modularity and reusability both degrade: a change to the API call shape ripples into the rendering logic and breaks tests that only intended to cover the UI. AI-generated "God components" in app/page.tsx are a common failure mode — the model writes one large coherent component because it never has to maintain it.
Severity rationale
Medium because mixed-concern components increase bug surface and slow down every future change, but they do not immediately break production behavior.
Remediation
Extract data fetching into server components or custom hooks, leaving rendering components purely presentational. For Next.js App Router:
// app/dashboard/page.tsx (server component — fetches)
export default async function DashboardPage() {
const data = await fetchDashboardData()
return <DashboardView data={data} />
}
// components/DashboardView.tsx (client component — renders)
export function DashboardView({ data }: { data: DashboardData }) {
// pure rendering logic only
}
A useful heuristic: if you can't describe what a component does in one sentence without the word "and," split it.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Code Maintainability Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · maintainability.modularity — Modularity
- iso-25010:2011 · maintainability.reusability — Reusability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from code-maintainability·automated