Merge pull request #3274 from influxdata/fixes/viewer-changes-temp-var

Guard against missing me
pull/3280/head
Brandon Farmer 2018-04-19 16:37:06 -07:00 committed by GitHub
commit b2c93d3eb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1,9 +1,11 @@
import React, {ReactElement, Component} from 'react'
import _ from 'lodash'
import PropTypes from 'prop-types'
import {withRouter, InjectedRouter} from 'react-router'
import {Location} from 'history'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'
import {ErrorHandling} from 'src/shared/decorators/errors'
import {
isUserAuthorized,
@ -52,6 +54,7 @@ interface Props {
// Acts as a 'router middleware'. The main `App` component is responsible for
// getting the list of data sources, but not every page requires them to function.
// Routes that do require data sources can be nested under this component.
@ErrorHandling
export class CheckSources extends Component<Props, State> {
public static childContextTypes = {
source: PropTypes.shape({
@ -111,9 +114,11 @@ export class CheckSources extends Component<Props, State> {
params,
errorThrown,
sources,
auth: {isUsingAuth, me, me: {organizations = [], currentOrganization}},
auth: {isUsingAuth, me},
notify,
} = nextProps
const organizations = _.get(me, 'organizations', [])
const currentOrganization = _.get(me, 'currentOrganization')
const {isFetching} = nextState
const source = sources.find(s => s.id === params.sourceID)
const defaultSource = sources.find(s => s.default === true)