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 08:38:00 +01:00
committed by GitHub
parent 2bb7eb18d1
commit bad048b7ba
299 changed files with 1135 additions and 1137 deletions

View File

@@ -1,4 +1,4 @@
import _ from 'lodash';
import { defaults, each, sortBy } from 'lodash';
import config from 'app/core/config';
import { DashboardModel } from '../../state/DashboardModel';
@@ -170,7 +170,7 @@ export class DashboardExporter {
return Promise.all(promises)
.then(() => {
_.each(datasources, (value: any) => {
each(datasources, (value: any) => {
inputs.push(value);
});
@@ -199,9 +199,9 @@ export class DashboardExporter {
// make inputs and requires a top thing
const newObj: { [key: string]: {} } = {};
newObj['__inputs'] = inputs;
newObj['__requires'] = _.sortBy(requires, ['id']);
newObj['__requires'] = sortBy(requires, ['id']);
_.defaults(newObj, saveModel);
defaults(newObj, saveModel);
return newObj;
})
.catch((err) => {