rusackas commented on a change in pull request #15480:
URL: https://github.com/apache/superset/pull/15480#discussion_r670169729



##########
File path: 
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts
##########
@@ -99,3 +100,28 @@ export const doesColumnMatchFilterType = (filterType: 
string, column: Column) =>
   !column.type_generic ||
   !(filterType in FILTER_SUPPORTED_TYPES) ||
   FILTER_SUPPORTED_TYPES[filterType]?.includes(column.type_generic);
+
+export const mostUsedDataset = (
+  datasets: DatasourcesState,
+  charts: ChartsState,
+) => {

Review comment:
       Your logic here is all good... but for sport, this got me thinking... If 
you want to get fancy, you might be able to one-liner this with lodash magic... 
something like:
   ```
   const mostUsedDataset = _(charts)
     .countBy('formData.datasource')
     .toPairs()
     .orderBy([1], ['desc'])
     .value().shift()[0];
   
   return datasets[mostUsedDataset]?.id;
    ```
   ... but that's probably even more difficult to read 😜




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