rusackas commented on code in PR #41311:
URL: https://github.com/apache/superset/pull/41311#discussion_r3457608651
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/forecast.ts:
##########
@@ -98,15 +98,21 @@ export const formatForecastTooltipSeries = ({
}): string[] => {
const name = `${marker}${sanitizeHtml(seriesName)}`;
let value = typeof observation === 'number' ? formatter(observation) : '';
- if (forecastTrend || forecastLower || forecastUpper) {
+ // Use explicit numeric checks rather than truthiness so that legitimate
+ // zero values (e.g. a forecast that crosses zero, or a confidence bound of
+ // exactly 0) are not dropped from the tooltip.
+ const hasTrend = typeof forecastTrend === 'number';
+ const hasLower = typeof forecastLower === 'number';
+ const hasUpper = typeof forecastUpper === 'number';
Review Comment:
Good catch — the old truthiness check happened to drop `NaN`, and my
`typeof` guards let it back through. Switched to `Number.isFinite` so zero
stays but `NaN`/`Infinity` are excluded, plus a test for it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]