Skip to content

Commit 0e19ca3

Browse files
committed
feat: error boundary error tip
1 parent c8c8b96 commit 0e19ca3

File tree

6 files changed

+269
-225
lines changed

6 files changed

+269
-225
lines changed

package-lock.json

Lines changed: 86 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@
286286
"@ant-design/icons": "^6.1.0",
287287
"@ant-design/v5-patch-for-react-19": "^1.0.3",
288288
"@codesandbox/sandpack-react": "^2.20.0",
289+
"@dagrejs/dagre": "^1.1.8",
289290
"@loadable/component": "^5.16.7",
290291
"@number-flow/react": "^0.5.10",
291292
"@react-spring/web": "^10.0.3",
@@ -299,6 +300,7 @@
299300
"@use-gesture/react": "^10.3.1",
300301
"@vercel/analytics": "^1.6.1",
301302
"@vercel/speed-insights": "^1.3.1",
303+
"@xyflow/react": "^12.10.0",
302304
"animate.css": "^4.1.1",
303305
"antd": ">=6.0.0",
304306
"axios": "^1.13.2",
@@ -310,8 +312,6 @@
310312
"core-js": "^3.47.0",
311313
"cross-fetch": "^4.1.0",
312314
"crypto-js": "^4.2.0",
313-
"cytoscape": "^3.33.1",
314-
"cytoscape-cose-bilkent": "^4.1.0",
315315
"d3": "^7.9.0",
316316
"dayjs": "^1.11.19",
317317
"echarts": "^6.0.0",
@@ -354,7 +354,6 @@
354354
"react-canvas-confetti": "^2.0.7",
355355
"react-countup": "^6.5.3",
356356
"react-css-theme-switcher": "^0.3.0",
357-
"react-cytoscapejs": "^2.0.0",
358357
"react-dom": ">=19.0.0",
359358
"react-draggable": "^4.5.0",
360359
"react-error-boundary": "^6.0.0",

src/components/ErrorBoundary.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ type State = {
1818
}
1919

2020
export default class ErrorBoundary extends React.Component<Props, State> {
21+
static defaultProps = {
22+
showDetails: true,
23+
}
2124
state: State = { hasError: false }
2225

2326
static getDerivedStateFromError(error: Error) {

src/components/stateful/index.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/pages/layout/proTabs/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import useSafeNavigate from '@app-hooks/useSafeNavigate'
44
import { Tabs, Dropdown, Space, theme, Button } from 'antd'
55
import StickyBox from 'react-sticky-box'
66
import { SyncOutlined, FireOutlined, DownOutlined } from '@ant-design/icons'
7-
import MyErrorBoundary from '@stateful'
7+
import ErrorBoundary from '@/components/ErrorBoundary'
88
import { nanoid } from 'nanoid'
99
import { useTranslation } from 'react-i18next'
1010
import { useProTabContext } from '@app-hooks/proTabsContext'
@@ -195,7 +195,7 @@ const ProTabs = (props) => {
195195
closable: pane.closable,
196196
forceRender: true,
197197
children: (
198-
<MyErrorBoundary onReset={fixError} navigate={redirectTo}>
198+
<ErrorBoundary onReset={fixError} navigate={redirectTo}>
199199
<div className="layout-tabpanel">
200200
<KeepAlive id={pane.key} active={pane.key === fullPath} persistOnUnmount={pane.key === '/'}>
201201
<Suspense fallback={<Loading />}>
@@ -207,7 +207,7 @@ const ProTabs = (props) => {
207207
</Suspense>
208208
</KeepAlive>
209209
</div>
210-
</MyErrorBoundary>
210+
</ErrorBoundary>
211211
),
212212
}))}
213213
/>

0 commit comments

Comments
 (0)