bito-code-review[bot] commented on PR #44810:
URL: https://github.com/apache/superset/pull/44810#issuecomment-5901900733

   <!-- Bito Reply -->
   The flagged issue is correct. Relying solely on the length of the `dataZoom` 
array to determine if components match is insufficient, as reordered or 
replaced components could lead to incorrect viewport restoration by index. To 
resolve this, you should verify that the components themselves are compatible 
(e.g., by comparing their IDs or types) rather than just their count.
   
   Here is a concise implementation to improve the validation:
   
   ```typescript
   // Replace the length check with a more robust validation
   const newZoom = (chartRef.current?.getOption() as { dataZoom?: 
DataZoomComponentOption[] })?.dataZoom;
   
   // Ensure both arrays have the same length and verify component identity if 
possible
   if (newZoom?.length === previousZoom.length && 
       newZoom.every((dz, i) => dz.id === previousZoom[i].id)) {
     // ... proceed with batch dispatch
   }
   ```
   
   There are no other comments available in this PR to review. Would you like 
me to perform any further analysis?
   
   **superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx**
   ```
   const newZoom = (chartRef.current?.getOption() as { dataZoom?: 
DataZoomComponentOption[] })?.dataZoom;
   
   // Ensure both arrays have the same length and verify component identity if 
possible
   if (newZoom?.length === previousZoom.length && 
       newZoom.every((dz, i) => dz.id === previousZoom[i].id)) {
     // ... proceed with batch dispatch
   }
   ```


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