MD.OFFICE
FAL

Daily Log - 2026-02-27

Formula Validations (Dynaform Builder)

  • PrimeNG Accordion Refactoring: Replaced custom logic with PrimeNG's p-accordion for consistent UI structuring across Built-in and Formula validations.
  • Draft and Persisted Rules Lifecycle:
    • Restructured how validation rules are managed: New rules click-added now exist purely as "drafts" initially.
    • Rules are only persisted into the actual form configuration (selectedItem.validationRules) upon successful back-end API validation (when the formula builder emits a valid formulaChange).
    • This prevents invalid or unconfigured formulas from polluting the JSON state and preserves the last known valid formula on subsequent edits.
  • Duplicate Prevention: Implemented toast validation to stop users from adding multiple unconfigured draft rules at once.
  • Performance Optimization: Refactored the unified allRules aggregation from an Angular template getter (which ran on every change detection cycle) into a plain array updated deliberately via refreshAllRules() on mutations and component initialization.

Form Engine Architecture Review

  • Exploration & Strategy: Conducted an exhaustive review of exactly how form-engine.service.ts parses and attaches cross-field formula validations.
  • AsyncValidatorFn vs Manual setErrors: Explored if Angular 19+ AsyncValidatorFn could simplify validation. Concluded that the current decoupled setErrors pattern is actually correct and necessary, as AsyncValidatorFn only receives the scope of its own control and natively lacks cross-field reactiveness.
  • Decoupled Evaluator Attachment: Verified that collecting formula elements during recursive control building (addControlsRecursive) and wiring their observables post-build is architecturally sound, testable, and robust against dependency order issues.
  • Identified Code Debt & Fix Requirements:
    • Identified the absence of basic debounceTime, leading to excessive network calls on intermediate keystrokes.