codeant-ai-for-open-source[bot] commented on code in PR #36214:
URL: https://github.com/apache/superset/pull/36214#discussion_r4078312607


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -178,6 +178,29 @@ function getSymbolMarker(symbol: string, color: string) {
   }
 }
 
+// ----- natural sort helper -----
+// Try numeric comparison first for numeric-like strings, fallback to 
localeCompare.
+function naturalCompare(a: any, b: any): number {
+  const sa = a === undefined || a === null ? '' : String(a);
+  const sb = b === undefined || b === null ? '' : String(b);
+
+  // Handle empty strings explicitly so they are not treated as 0
+  if (sa === '' && sb === '') return 0;
+  if (sa === '') return -1;
+  if (sb === '') return 1;
+
+  const na = Number(sa);
+  const nb = Number(sb);
+
+  // If both parse as finite numbers, do numeric sort
+  if (isFinite(na) && isFinite(nb)) {
+    return na - nb;
+  }

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `60d26b1`.
   
   Integer-like string values are now compared with BigInt before numeric 
conversion, preserving distinctions beyond Number.MAX_SAFE_INTEGER.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



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