diff --git a/apps/hosted-components/src/routes/__root.tsx b/apps/hosted-components/src/routes/__root.tsx index 77e5e5250..ebc437d2d 100644 --- a/apps/hosted-components/src/routes/__root.tsx +++ b/apps/hosted-components/src/routes/__root.tsx @@ -4,6 +4,7 @@ import { publishableClientKeyNotNecessarySentinel } from '@hexclave/shared/dist/ import { runAsynchronously } from '@hexclave/shared/dist/utils/promises'; import { validateRedirectUrl } from '@hexclave/shared/dist/utils/redirect-urls'; import { isRelative } from '@hexclave/shared/dist/utils/urls'; +import { throwErr } from '@hexclave/shared/dist/utils/errors'; import { HeadContent, Outlet, @@ -65,7 +66,7 @@ function useHostedComponentsNavigate() { await navigate({ hash: to.slice(1) }); } else { if (!isTrustedNavigationTarget(to)) { - throw new Error(`Refusing to navigate to untrusted URL: ${to}`); + throw new Error("Refusing to navigate to an untrusted URL"); } await navigate({ href: to }); } @@ -195,9 +196,11 @@ function RootComponent() { return ; } + const app = hexclaveApp ?? throwErr("RootComponent expected a HexclaveClientApp after project ID validation."); + return ( - +