kgabryje commented on a change in pull request #16362:
URL: https://github.com/apache/superset/pull/16362#discussion_r693045780
##########
File path: superset-frontend/src/explore/components/DatasourcePanel/index.tsx
##########
@@ -193,61 +194,64 @@ export default function DataSourcePanel({
const DEFAULT_MAX_COLUMNS_LENGTH = 50;
const DEFAULT_MAX_METRICS_LENGTH = 50;
- const search = useCallback(
- debounce((value: string) => {
- if (value === '') {
- setList({ columns, metrics });
- return;
- }
- setList({
- columns: matchSorter(columns, value, {
- keys: [
- {
- key: 'verbose_name',
- threshold: rankings.CONTAINS,
- },
- {
- key: 'column_name',
- threshold: rankings.CONTAINS,
- },
- {
- key: item =>
- [item.description, item.expression].map(
- x => x?.replace(/[_\n\s]+/g, ' ') || '',
- ),
- threshold: rankings.CONTAINS,
- maxRanking: rankings.CONTAINS,
- },
- ],
- keepDiacritics: true,
- }),
- metrics: matchSorter(metrics, value, {
- keys: [
- {
- key: 'verbose_name',
- threshold: rankings.CONTAINS,
- },
- {
- key: 'metric_name',
- threshold: rankings.CONTAINS,
- },
- {
- key: item =>
- [item.description, item.expression].map(
- x => x?.replace(/[_\n\s]+/g, ' ') || '',
- ),
- threshold: rankings.CONTAINS,
- maxRanking: rankings.CONTAINS,
- },
- ],
- keepDiacritics: true,
- baseSort: (a, b) =>
- Number(b.item.is_certified) - Number(a.item.is_certified) ||
- String(a.rankedValue).localeCompare(b.rankedValue),
- }),
- });
- }, FAST_DEBOUNCE),
- [columns, metrics],
+ const search = debounce(
Review comment:
I've just verified - simply replacing useCallback with useMemo solves
the eslint problem
```
const search = useMemo(
() =>
debounce((value: string) => {
...
```
--
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]