diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx new file mode 100644 index 0000000..0f8c74e --- /dev/null +++ b/src/components/ErrorBoundary.tsx @@ -0,0 +1,12 @@ +import { raiseError } from 'analytics' +import * as React from 'react' + +export class ErrorBoundary extends React.PureComponent { + componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { + raiseError(error, errorInfo) + } + + render() { + return this.props.children + } +} diff --git a/src/components/Gitako.tsx b/src/components/Gitako.tsx index 28ace02..7c68258 100644 --- a/src/components/Gitako.tsx +++ b/src/components/Gitako.tsx @@ -1,20 +1,16 @@ -import { raiseError } from 'analytics' import { SideBar } from 'components/SideBar' import { ConfigsContext, ConfigsContextWrapper } from 'containers/ConfigsContext' import * as React from 'react' +import { ErrorBoundary } from './ErrorBoundary' -export class Gitako extends React.PureComponent { - componentDidCatch(error: Error, errorInfo: React.ErrorInfo) { - raiseError(error, errorInfo) - } - - render() { - return ( +export function Gitako() { + return ( + {configContext => configContext && } - ) - } + + ) }