diff --git a/app/soapbox/components/error_boundary.js b/app/soapbox/components/error_boundary.js index b2b077a5f..069519f03 100644 --- a/app/soapbox/components/error_boundary.js +++ b/app/soapbox/components/error_boundary.js @@ -1,7 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import Bowser from 'bowser'; import * as Sentry from '@sentry/browser'; export default class ErrorBoundary extends React.PureComponent { @@ -23,6 +22,14 @@ export default class ErrorBoundary extends React.PureComponent { error, componentStack: info && info.componentStack, }); + + import(/* webpackChunkName: "error" */'bowser') + .then(({ default: Bowser }) => { + this.setState({ + browser: Bowser.getParser(window.navigator.userAgent), + }); + }) + .catch(() => {}); } setTextareaRef = c => { @@ -49,9 +56,7 @@ export default class ErrorBoundary extends React.PureComponent { } render() { - const browser = Bowser.getParser(window.navigator.userAgent); - - const { hasError } = this.state; + const { browser, hasError } = this.state; if (!hasError) { return this.props.children; @@ -75,9 +80,9 @@ export default class ErrorBoundary extends React.PureComponent { onClick={this.handleCopy} readOnly />} -

+ {browser &&

{browser.getBrowserName()} {browser.getBrowserVersion()} -

+

}