Ver código fonte

fix: error boundary with key

GyDi 1 ano atrás
pai
commit
3557a77645
1 arquivos alterados com 13 adições e 7 exclusões
  1. 13 7
      src/pages/_layout.tsx

+ 13 - 7
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>