Merge pull request #3273 from influxdata/fixes/component-error-handling-names

Show proper name for components with error handling
pull/3280/head
Brandon Farmer 2018-04-19 16:34:55 -07:00 committed by GitHub
commit b3c3a60c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,10 @@ export function ErrorHandling<
T extends {new (...args: any[]): React.Component<P, S>}
>(constructor: T) {
class Wrapped extends constructor {
public static get displayName(): string {
return constructor.name
}
private error: boolean = false
public componentDidCatch(error, info) {
@ -29,5 +33,6 @@ export function ErrorHandling<
return super.render()
}
}
return Wrapped
}