fix: Chart not displayed when formula references an undefined field#3360
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughFormula evaluation now handles missing variables by defaulting them to ChangesFormula evaluation with undefined variable handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 OpenGrep (1.20.0)OpenGrep fatal error (exit code 2): [00.15][ERROR]: Error: exception Unix_error: No such file or directory stat src/lib/FormulaEvaluator.js Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
## [9.1.2-alpha.1](9.1.1...9.1.2-alpha.1) (2026-05-18) ### Bug Fixes * Chart not displayed when formula references an undefined field ([#3360](#3360)) ([9666935](9666935))
|
🎉 This change has been released in version 9.1.2-alpha.1 |
Pull Request
Issue
In the Data Browser, when creating a chart (e.g. bar chart) and adding a calculated value with the
formulaoperator, the chart did not render any data if the formula referenced a field whose value wasundefined(or missing) on the data rows.This was inconsistent with the
sumoperator, which already treats a missing/undefined field as0and still renders the chart.Approach
When
expr-eval-forkevaluates a formula and encounters an identifier that is not in the variables map, it throws. The error was being caught andevaluateFormulareturnednullfor every row, leaving the chart with no data.evaluateFormulanow fills in any variables referenced by the parsed formula but missing from the variables map with0before evaluation. This makesformulabehave consistently withsum: a referenced field that is undefined on a row is treated as0, and the chart renders.Note that this only affects runtime evaluation. Formula validation in the chart configuration dialog still rejects unknown identifiers, so genuine typos are caught at configuration time.
Tasks
Summary by CodeRabbit
Bug Fixes
Tests