michael-s-molina commented on code in PR #30949:
URL: https://github.com/apache/superset/pull/30949#discussion_r1848980006


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -288,11 +288,20 @@ export default function transformProps(
         entry,
         ensureIsArray(chartProps.rawFormData?.time_compare),
       )!;
-      if (!offsetLineWidths[offset]) {
-        offsetLineWidths[offset] = Object.keys(offsetLineWidths).length + 1;
+      if (!offsetLineWidths.includes(offset)) {

Review Comment:
   The map approach is more efficient than looping through the elements with 
`include`.



##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -288,11 +288,20 @@ export default function transformProps(
         entry,
         ensureIsArray(chartProps.rawFormData?.time_compare),
       )!;
-      if (!offsetLineWidths[offset]) {
-        offsetLineWidths[offset] = Object.keys(offsetLineWidths).length + 1;
+      if (!offsetLineWidths.includes(offset)) {

Review Comment:
   The previous map approach is more efficient than looping through the 
elements with `include`.



-- 
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]

Reply via email to