From 3017155867187bda16fba2debcd7e43402cbf661 Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Wed, 7 Jul 2021 14:18:37 +0800 Subject: [PATCH] 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 --- ui/component/errorBoundary/view.jsx | 51 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/ui/component/errorBoundary/view.jsx b/ui/component/errorBoundary/view.jsx index 65e090fe8..6e10fc5bb 100644 --- a/ui/component/errorBoundary/view.jsx +++ b/ui/component/errorBoundary/view.jsx @@ -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,29 +74,27 @@ class ErrorBoundary extends React.Component { if (hasError) { return (
- - - ), - }} - > - There was an error. Try %refreshing_the_app_link% to fix it. If that doesn't work, try pressing - Ctrl+R/Cmd+R. - - } - /> - + + ), + }} + > + There was an error. Try %refreshing_the_app_link% to fix it. If that doesn't work, try pressing + Ctrl+R/Cmd+R. + + } + /> {!errorWasReported && (