fix(app): redirect invalid server routes

This commit is contained in:
Brendan Allan 2026-07-29 07:12:13 +00:00 committed by opencode-agent[bot]
commit 366614537e
2 changed files with 2 additions and 19 deletions

View file

@ -132,7 +132,7 @@ function TargetServerRoute(props: ParentProps) {
// Owns the server-identity remount. Session changes must NOT remount this
// subtree (SessionRouteErrorBoundary resets and createSessionLineage
// re-resolves reactively instead); both rely on this key for server changes.
<Show when={key()} keyed fallback={<InvalidServerRoute />}>
<Show when={key()} keyed fallback={<Navigate href="/" />}>
<ServerSDKProvider server={conn}>
<ServerSyncProvider server={conn}>{props.children}</ServerSyncProvider>
</ServerSDKProvider>
@ -164,23 +164,6 @@ function LegacyTargetSessionRouteContent() {
)
}
function InvalidServerRoute() {
const language = useLanguage()
const navigate = useNavigate()
return (
<div class="flex-1 w-full min-h-0 flex flex-col items-center justify-center gap-3 text-center">
<div class="text-16-medium text-text-strong">Invalid server route</div>
<button
type="button"
class="text-13-regular text-text-interactive-base"
onClick={() => navigate("/", { replace: true })}
>
{language.t("home.title")}
</button>
</div>
)
}
function LegacyTargetSessionRedirect() {
const params = useParams<{ id: string }>()
const navigate = useNavigate()

View file

@ -41,7 +41,7 @@ describe("session routes", () => {
expect(parseServerKey(href.split("/")[2])).toBe(server)
})
test("returns an invalid state for malformed server routes", () => {
test("returns undefined for malformed server routes", () => {
expect(parseServerKey("not-base64")).toBeUndefined()
})