Don't lazy-load components in ErrorBoundary

We currently handle major errors through ErrorBoundary. If the error is network related, ErrorBoundary ends up blank if it's components are lazy-loaded.

#codesplit
This commit is contained in:
infinite-persistence 2021-07-07 14:18:37 +08:00
parent 3fad222848
commit 3017155867
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -1,15 +1,14 @@
// @flow
import type { Node } from 'react';
import React from 'react';
import Yrbl from 'component/yrbl';
import Button from 'component/button';
import { withRouter } from 'react-router';
import analytics from 'analytics';
import I18nMessage from 'component/i18nMessage';
import Native from 'native';
import { Lbry } from 'lbry-redux';
const Button = React.lazy(() => import('component/button' /* webpackChunkName: "button" */));
const I18nMessage = React.lazy(() => import('component/i18nMessage' /* webpackChunkName: "i18nMessage" */));
const Yrbl = React.lazy(() => import('component/yrbl' /* webpackChunkName: "yrbl" */));
type Props = {
children: Node,
history: {
@ -75,7 +74,6 @@ class ErrorBoundary extends React.Component<Props, State> {
if (hasError) {
return (
<div className="main main--full-width main--empty">
<React.Suspense fallback={null}>
<Yrbl
type="sad"
title={__('Aw shucks!')}
@ -97,7 +95,6 @@ class ErrorBoundary extends React.Component<Props, State> {
</I18nMessage>
}
/>
</React.Suspense>
{!errorWasReported && (
<div className="error__wrapper">
<span className="error__text">