villebro commented on code in PR #30393:
URL: https://github.com/apache/superset/pull/30393#discussion_r1775914260


##########
superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/customControls.tsx:
##########
@@ -66,10 +67,16 @@ function isForcedCategorical(controls: 
ControlStateMapping): boolean {
 }
 
 function isSortable(controls: ControlStateMapping): boolean {
+  const xAxisValue = controls?.x_axis?.value as QueryFormColumn;
+  // Given that we don't know the type of a custom SQL column,
+  // we treat it as sortable and give the responsibility to the
+  // user to provide a sortable result.
+  const isCustomSQL = !isPhysicalColumn(xAxisValue);
   return (
     isForcedCategorical(controls) ||
+    isCustomSQL ||
     checkColumnType(
-      getColumnLabel(controls?.x_axis?.value as QueryFormColumn),
+      getColumnLabel(xAxisValue),

Review Comment:
   I was wondering why this was passing our 100 % coverage check, but it turns 
out this file is `tsx` which is ignored in the check. I'm thinking at some 
point we should really move this type of critical non-React logic into `.ts` 
files and start adding tests for them. For this specific function, I'd maybe 
move it under `src/shared-controls/utils/isSortable.ts` and then add a test for 
it.



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