Skip to content

Commit 9ff7bf8

Browse files
StiensWoutclaude
andcommitted
fix(web): report the router path so desktop error reports name the route
Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 77a5bb4 commit 9ff7bf8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎apps/web/src/routes/__root.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ function HostedStaticEnvironmentBootstrap() {
269269

270270
function RootRouteErrorView({ error, reset }: ErrorComponentProps) {
271271
const message = errorMessage(error);
272-
const report = useMemo(() => errorReport(error), [error]);
272+
// Router pathname rather than window.location: desktop uses hash history, where the window path is always "/".
273+
const pathname = useLocation({ select: (location) => location.pathname });
274+
const report = useMemo(() => errorReport(error, pathname), [error, pathname]);
273275

274276
return (
275277
<div className="relative flex min-h-screen items-center justify-center overflow-hidden bg-background px-4 py-10 text-foreground sm:px-6">
@@ -352,13 +354,13 @@ const MAX_ERROR_CAUSE_DEPTH = 5;
352354

353355
/**
354356
* Full error text for bug reports: app build, page path, time, then the stack
355-
* and any cause chain. Uses the pathname only so tokens in the query never
357+
* and any cause chain. Takes the pathname only so tokens in the query never
356358
* land on the clipboard.
357359
*/
358-
function errorReport(error: unknown): string {
360+
function errorReport(error: unknown, pathname: string): string {
359361
const lines = [
360362
`${APP_DISPLAY_NAME} ${APP_VERSION}`,
361-
`Path: ${window.location.pathname}`,
363+
`Path: ${pathname}`,
362364
`Time: ${new Date().toISOString()}`,
363365
"",
364366
errorDetails(error),

0 commit comments

Comments
 (0)