crumb 直接读 match.data.word,loader 失败时 data 为空,整页崩成 React Router 的 「Unexpected Application Error」。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -22,7 +22,9 @@ const termRoutes: RouteObject[] = [
loader: termLoader,
errorElement: createElement(RouteError, { backTo: "/workspace/term" }),
handle: {
- crumb: (match: { data: { word: string } }) => match.data.word,
+ // loader 失败时 data 为空(错误页那时也要渲染面包屑)
+ crumb: (match: { data?: { word?: string } }) =>
+ match.data?.word ?? "",
},
children: [
{