eschutho commented on code in PR #23762:
URL: https://github.com/apache/superset/pull/23762#discussion_r1181837953
##########
superset-frontend/packages/superset-ui-core/src/color/CategoricalColorScale.ts:
##########
@@ -96,7 +98,22 @@ class CategoricalColorScale extends ExtensibleFunction {
const newColor = this.scale(cleanedValue);
if (!color) {
color = newColor;
+ // make sure we don't overwrite the origin colors
+ if (!isFeatureEnabled(FeatureFlag.USE_ANALAGOUS_COLORS)) {
+ const updatedRange = [...this.originColors];
+ // remove the color option from shared color
+ sharedColorMap.forEach((value, key) => {
+ if (key !== cleanedValue) {
+ const index = updatedRange.indexOf(value);
+ updatedRange.splice(index, 1);
Review Comment:
It looks like this may be removing items from a list. Can you use a filter
function here instead?
##########
superset-frontend/packages/superset-ui-core/src/color/CategoricalColorScale.ts:
##########
@@ -96,7 +98,22 @@ class CategoricalColorScale extends ExtensibleFunction {
const newColor = this.scale(cleanedValue);
if (!color) {
color = newColor;
+ // make sure we don't overwrite the origin colors
+ if (!isFeatureEnabled(FeatureFlag.USE_ANALAGOUS_COLORS)) {
+ const updatedRange = [...this.originColors];
+ // remove the color option from shared color
+ sharedColorMap.forEach((value, key) => {
+ if (key !== cleanedValue) {
+ const index = updatedRange.indexOf(value);
+ updatedRange.splice(index, 1);
Review Comment:
It looks like this may be removing items from a list. Can you use the filter
function here instead?
--
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]