justinpark commented on code in PR #24477:
URL: https://github.com/apache/superset/pull/24477#discussion_r1237795842


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -272,15 +235,14 @@ export default function EchartsTimeseries({
         // @ts-ignore
         const globalModel = echartInstance.getModel();
         const model = getModelInfo(params.target, globalModel);
-        const seriesCount = globalModel.getSeriesCount();
-        const currentSeriesIndices = globalModel.getCurrentSeriesIndices();
         if (model) {
           const { name } = model;
-          if (seriesCount !== currentSeriesIndices.length) {
-            handleDoubleClickChange();
-          } else {
-            handleDoubleClickChange(name);
-          }
+          const legendState: LegendState = legendData
+            .map(datum => ({
+              [datum]: datum === name,
+            }))
+            .reduce((previous, current) => ({ ...previous, ...current }));

Review Comment:
   If I understand correctly, you don't need to have additional `.map` 
iteration. just `.reduce` can cover this
   
   ```suggestion
               .reduce((previous, datum) => ({
                  ...previous,
                  [datum]: datum == name,
               }));
   ```



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