sadpandajoe commented on code in PR #44208:
URL: https://github.com/apache/superset/pull/44208#discussion_r4169267938


##########
superset-frontend/packages/superset-ui-core/src/components/TableCollection/utils.tsx:
##########
@@ -84,35 +90,49 @@ function getSortingInfo<T extends object>(
 }
 
 export function mapColumns<T extends object>(
-  columns: EnhancedColumnInstance<T>[],
-  headerGroups: EnhancedHeaderGroup<T>[],
+  columns: ListViewColumn<T>[],
+  headerGroups: HeaderGroup<T>[],
   columnsForWrapText?: string[],
 ) {
   return columns.map(column => {
-    const { isSorted, isSortedDesc } = getSortingInfo(headerGroups, column.id);
+    // react-table backfills `id` from a string `accessor` for its own
+    // internal column instances, but callers routinely author raw column
+    // configs (the shape this function actually receives, per
+    // `ListViewColumn`) with only `accessor` set. Falling back to it here
+    // keeps every column's antd `key`/`dataIndex` unique; without it,
+    // id-less columns all collapse onto the same (undefined) key and antd
+    // can't tell them apart for sorting.
+    const id =
+      column.id ??
+      (typeof column.accessor === 'string' ? column.accessor : undefined) ??
+      '';
+    const { isSorted, isSortedDesc } = getSortingInfo(headerGroups, id);
     return {

Review Comment:
   Clicking the User header on Action Log now sends `order_column=user`, but 
the Log API only allows scalar ordering fields such as `user.username`, so it 
returns 400 and subsequent pagination/filter requests keep the invalid sort. 
Could we disable sorting for this relationship column or map it to a supported 
ordering field?



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