mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Add ErrorBoundary to page content
Prevent the page from turning into a black screen when page rendering fails by adding an error boundary to the display of the page content in SiteLayout.jsx.
This commit is contained in:
1 parent
ac17b8497a
commit
b538960592
4 files changed
+50
-1
No files matched your search
@@ -3,6 +3,9 @@ import { Switch, Route, useHistory } from "react-router-dom";
|
||||
import { Layout, Menu } from "antd";
|
||||
import webUiPackage from "../../package.json";
|
||||
|
||||
import ErrorBoundary from "./ErrorBoundary";
|
||||
import ErrorPage from "./ErrorPage";
|
||||
|
||||
const { Header, Sider } = Layout;
|
||||
|
||||
|
||||
@@ -74,7 +77,9 @@ export default function SiteLayout(props) {
|
||||
</Route>)}
|
||||
{pages.map(page => <Route exact path={page.path} key={page.path}>
|
||||
<SetSidebar path={page.sidebarPath} />
|
||||
{page.content}
|
||||
<ErrorBoundary Component={ErrorPage}>
|
||||
{page.content}
|
||||
</ErrorBoundary>
|
||||
</Route>)}
|
||||
<Route>
|
||||
<SetSidebar path={null} />
|
||||
|
||||
Reference in new issue
Block a user