justinpark commented on PR #28749: URL: https://github.com/apache/superset/pull/28749#issuecomment-2137783537
> justinpark if you look at the default [DEFAULT_SORT_COMPARATOR](https://github.com/apache/superset/blob/07b2449bd777cf04a266f1de3d72af6874b9c305/superset-frontend/src/components/Select/constants.ts#L30C14-L30C37) implementation, you can see that it will sort items alphabetically if `label` is of type `string`. In this case, it's not sorting alphabetically because `label` is being set to a React component [here](https://github.com/apache/superset/blob/07b2449bd777cf04a266f1de3d72af6874b9c305/superset-frontend/src/components/DatabaseSelector/index.tsx#L195) instead of using `customLabel` for that purpose. If you set `label` to `database_name` and `customLabel` to the React component, you'll get the desired behavior. You are right, but I think that if the API that includes the actual sorting items is implemented, we would want the results to be sorted according to the API. Also, relying on client-side sorting can lead to inconsistencies, especially when handling paginated results, so I believe it is better to follow the API's results. Additionally, I have optimized the code to use the suggested order 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org