From 3557a776450bdc87086d31168a55ef0929c6c887 Mon Sep 17 00:00:00 2001 From: GyDi <zzzgydi@gmail.com> Date: Fri, 30 Jun 2023 09:17:59 +0800 Subject: [PATCH] fix: error boundary with key --- src/pages/_layout.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/pages/_layout.tsx b/src/pages/_layout.tsx index 4011dd9..09c9f21 100644 --- a/src/pages/_layout.tsx +++ b/src/pages/_layout.tsx @@ -125,13 +125,19 @@ const Layout = () => { )} <div className="the-content"> - <BaseErrorBoundary> - <Routes> - {routers.map(({ label, link, ele: Ele }) => ( - <Route key={label} path={link} element={<Ele />} /> - ))} - </Routes> - </BaseErrorBoundary> + <Routes> + {routers.map(({ label, link, ele: Ele }) => ( + <Route + key={label} + path={link} + element={ + <BaseErrorBoundary key={label}> + <Ele /> + </BaseErrorBoundary> + } + /> + ))} + </Routes> </div> </div> </Paper> -- GitLab