Skip to content

Commit

Permalink
dev: use getDeep instead of _.get for stronger typing
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredscheib committed Aug 1, 2018
1 parent 3e86640 commit 80e0e01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/src/dashboards/components/ImportDashboardOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {PureComponent} from 'react'
import _ from 'lodash'
import {getDeep} from 'src/utils/wrappers'

import Container from 'src/reusable_ui/components/overlays/OverlayContainer'
import Heading from 'src/reusable_ui/components/overlays/OverlayHeading'
Expand Down Expand Up @@ -114,8 +115,8 @@ class ImportDashboardOverlay extends PureComponent<Props, State> {
const {dashboard, meta} = JSON.parse(uploadContent)

if (!_.isEmpty(dashboard)) {
const cells = _.get(dashboard, 'cells', [])
const importedSources = _.get(meta, 'sources', {})
const cells = getDeep<Cell[]>(dashboard, 'cells', [])
const importedSources = getDeep<ImportedSources>(meta, 'sources', {})
this.setState({
cells,
dashboard,
Expand Down

0 comments on commit 80e0e01

Please sign in to comment.