2026-04-07
Matrix Widget: Formula Builder Suggestions Context
Enhanced the formula builder dropdown in the matrix to properly differentiate column suggestions when groups are used.
Decisions & Solutions
- Contextual Transparency: In
getMatrixColReferenceFields, check ifuseColumnGroupsis enabled. If so, iteratively extract and merge the group label with the column label into the dropdown display string (Col n — Group Label.Column Label). This ensures users can discern same-named columns belonging to different groups.
Matrix Formula Batch API — N HTTP calls -> 2
Optimized the matrix formula evaluation pipeline by implementing a batch API, reducing the number of backend requests from N*M+N down to a constant 2 (or 1+N where N is formula rows).
Decisions & Solutions
- Batch Execution: Introduced
POST /api/formula/evaluate-batchon the backend to evaluate multiple expressions in a single request. - Expression Deduplication: Implemented a per-request
Map<string, ParsedExpr>cache on the backend. This ensures that identical expressions (e.g., the same formula column across 20 rows) are parsed only once. - Frontend Refactoring: Refactored
evaluateFormulaColumn()andevaluateSingleFormulaRow$()inMatrixComponentto collect payloads and dispatch a singleevaluateFormulaBatch()call instead of parallelforkJoinindividual calls. - Sequential Safety: Maintained
concatMapsequential ordering for formula rows to ensure cascading references (e.g., Row 5 referencing Row 3) remain accurate. - Resilience: Maintained per-item try/catch on the backend so one malformed expression doesn't break the entire batch.