Performance: Standardize lodash imports to use destructured members (#33040)

* Performance: Standardize lodash imports to use destructured members
Changes lodash imports of the form `import x from 'lodash/x'` to
`import { x } from 'lodash'` to reduce bundle size.

* Remove unnecessary _ import from Graph component

* Enforce lodash import style

* Fix remaining lodash imports
This commit is contained in:
kay delaney
2021-04-21 09:38:00 +02:00
committed by GitHub
parent 2bb7eb18d1
commit bad048b7ba
299 changed files with 1135 additions and 1137 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
// Libraries
import _ from 'lodash';
import { flatten, omit, uniq } from 'lodash';
import { Unsubscribable } from 'rxjs';
// Services & Utils
import {
@@ -72,7 +72,7 @@ export async function getExploreUrl(args: GetExploreUrlArguments): Promise<strin
/** In Explore, we don't have legend formatter and we don't want to keep
* legend formatting as we can't change it
*/
let exploreTargets: DataQuery[] = panelTargets.map((t) => _.omit(t, 'legendFormat'));
let exploreTargets: DataQuery[] = panelTargets.map((t) => omit(t, 'legendFormat'));
let url: string | undefined;
// Mixed datasources need to choose only one datasource
@@ -441,7 +441,7 @@ export const getRefIds = (value: any): string[] => {
refIds.push(getRefIds(value[key]));
}
return _.uniq(_.flatten(refIds));
return uniq(flatten(refIds));
};
export const refreshIntervalToSortOrder = (refreshInterval?: string) =>