Copilot commented on code in PR #36101:
URL: https://github.com/apache/superset/pull/36101#discussion_r2524514971
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts:
##########
@@ -256,6 +256,8 @@ export const getColorFormatters = memoizeOne(
resolvedColorScheme = theme[config.colorScheme] as string;
}
+ console.log('resolvedColorScheme', resolvedColorScheme);
Review Comment:
Debug console.log statement should be removed before merging to production.
This will clutter the browser console unnecessarily.
```suggestion
```
##########
superset-frontend/packages/superset-ui-chart-controls/src/utils/getColorFormatters.ts:
##########
@@ -38,20 +38,20 @@ export const getOpacity = (
minOpacity = MIN_OPACITY_BOUNDED,
maxOpacity = MAX_OPACITY,
) => {
- if (
- extremeValue === cutoffPoint ||
- typeof cutoffPoint !== 'number' ||
- typeof extremeValue !== 'number' ||
- typeof value !== 'number'
- ) {
+ if (extremeValue === cutoffPoint || typeof value !== 'number') {
return maxOpacity;
}
+ const numCutoffPoint =
+ typeof cutoffPoint === 'string' ? parseFloat(cutoffPoint) : cutoffPoint;
+ const numExtremeValue =
+ typeof extremeValue === 'string' ? parseFloat(extremeValue) : extremeValue;
+
Review Comment:
parseFloat can return NaN for invalid string inputs. After parsing, validate
that numCutoffPoint and numExtremeValue are valid numbers using isNaN() or
Number.isFinite() before using them in calculations. Add a check like: `if
(!Number.isFinite(numCutoffPoint) || !Number.isFinite(numExtremeValue)) {
return maxOpacity; }`
```suggestion
if (!Number.isFinite(numCutoffPoint) || !Number.isFinite(numExtremeValue))
{
return maxOpacity;
}
```
--
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]