diff --git a/shared/rules/angular/references/components-and-state.md b/shared/rules/angular/references/components-and-state.md index 5ef82ab..3dfa789 100644 --- a/shared/rules/angular/references/components-and-state.md +++ b/shared/rules/angular/references/components-and-state.md @@ -4,13 +4,7 @@ * Keep components small; move substantial business logic to a focused service or domain layer. * Keep dependencies explicit and follow the feature architecture. Avoid god components, god services, unnecessary wrappers, and abstractions without a concrete need. * Use `ChangeDetectionStrategy.OnPush` unless there is a concrete reason not to. -* Prefer signal-based state for local component state. -* Prefer `computed` for derived state. -* Prefer `effect` only for actual side effects. -* Do not use `effect` as a replacement for normal data flow. -* Keep component state minimal. -* Avoid duplicating derived state. -* Prefer immutable state updates. +* Keep component state minimal and prefer immutable state updates. * Avoid direct mutation of shared state. * Keep inputs and outputs strongly typed. * Prefer signal-based inputs and outputs when consistent with the project. @@ -24,13 +18,9 @@ ## Signals and State * Prefer signals for local and synchronous reactive state. -* Prefer `computed` for derived values. -* Keep signals private when external mutation is not intended. -* Expose readonly state where practical. -* Avoid storing values that can be derived from existing state. +* Derive values with `computed` instead of storing or duplicating them; keep `computed` free of side effects. +* Keep signals private when external mutation is not intended, and expose readonly state where practical. * Avoid circular signal dependencies. -* Avoid side effects inside `computed`. -* Keep effects small and deterministic. -* Clean up resources created by effects. +* Use `effect` only for actual side effects, not as a replacement for normal data flow. Keep effects small and deterministic, and clean up resources they create. * Do not use global state unless multiple unrelated parts of the application genuinely need it. * Do not introduce a state-management library without a clear requirement.