mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: Clean up per PR feedback. Thanks @dprokop
This commit is contained in:
parent
f428db282c
commit
12a3edd6e5
@ -1,4 +1,4 @@
|
|||||||
import React, { Component } from 'react';
|
import { Component } from 'react';
|
||||||
|
|
||||||
interface ErrorInfo {
|
interface ErrorInfo {
|
||||||
componentStack: string;
|
componentStack: string;
|
||||||
@ -19,10 +19,10 @@ interface State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ErrorBoundary extends Component<Props, State> {
|
class ErrorBoundary extends Component<Props, State> {
|
||||||
constructor(props) {
|
readonly state: State = {
|
||||||
super(props);
|
error: null,
|
||||||
this.state = { error: null, errorInfo: null };
|
errorInfo: null,
|
||||||
}
|
};
|
||||||
|
|
||||||
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
componentDidCatch(error: Error, errorInfo: ErrorInfo) {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -32,15 +32,12 @@ class ErrorBoundary extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { children } = this.props;
|
||||||
const { error, errorInfo } = this.state;
|
const { error, errorInfo } = this.state;
|
||||||
return (
|
return children({
|
||||||
<>
|
|
||||||
{this.props.children({
|
|
||||||
error,
|
error,
|
||||||
errorInfo,
|
errorInfo,
|
||||||
})}
|
});
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,10 +10,6 @@ import { Options } from './types';
|
|||||||
interface Props extends PanelProps<Options> {}
|
interface Props extends PanelProps<Options> {}
|
||||||
|
|
||||||
export class GraphPanel extends PureComponent<Props> {
|
export class GraphPanel extends PureComponent<Props> {
|
||||||
constructor(props: Props) {
|
|
||||||
super(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { timeSeries, timeRange, width, height } = this.props;
|
const { timeSeries, timeRange, width, height } = this.props;
|
||||||
const { showLines, showBars, showPoints } = this.props.options;
|
const { showLines, showBars, showPoints } = this.props.options;
|
||||||
|
Loading…
Reference in New Issue
Block a user