mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Component display name fixes for Apollo examples (#2211)
* Fix decorated component display name issues for Apollo examples. * Fix linting errors and implement #2286
This commit is contained in:
parent
31db8dd932
commit
9bbdfeca63
|
@ -4,9 +4,14 @@ import { ApolloProvider, getDataFromTree } from 'react-apollo'
|
|||
import initApollo from './initApollo'
|
||||
import initRedux from './initRedux'
|
||||
|
||||
// Gets the display name of a JSX component for dev tools
|
||||
function getComponentDisplayName (Component) {
|
||||
return Component.displayName || Component.name || 'Unknown'
|
||||
}
|
||||
|
||||
export default ComposedComponent => {
|
||||
return class WithData extends React.Component {
|
||||
static displayName = `WithData(${ComposedComponent.displayName})`
|
||||
static displayName = `WithData(${getComponentDisplayName(ComposedComponent)})`
|
||||
static propTypes = {
|
||||
serverState: PropTypes.object.isRequired
|
||||
}
|
||||
|
|
|
@ -3,9 +3,14 @@ import PropTypes from 'prop-types'
|
|||
import { ApolloProvider, getDataFromTree } from 'react-apollo'
|
||||
import initApollo from './initApollo'
|
||||
|
||||
// Gets the display name of a JSX component for dev tools
|
||||
function getComponentDisplayName (Component) {
|
||||
return Component.displayName || Component.name || 'Unknown'
|
||||
}
|
||||
|
||||
export default ComposedComponent => {
|
||||
return class WithData extends React.Component {
|
||||
static displayName = `WithData(${ComposedComponent.displayName})`
|
||||
static displayName = `WithData(${getComponentDisplayName(ComposedComponent)})`
|
||||
static propTypes = {
|
||||
serverState: PropTypes.object.isRequired
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue