From 259419086903f715b40e79e954058ff2055155de Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Thu, 10 Sep 2026 14:46:16 +0300 Subject: [PATCH] fix(web): an empty path segment is not a window MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `tsc -b` in CI caught what `tsc --noEmit` locally did not: src/lib/routes.ts(131,3): error TS2322: Type '"" | Window | null' is not assignable to type 'Window | null'. `segment && LEGACY_WINDOWS[segment]` returns `''` for an empty path rather than falling through to the `?? null`, so the root route's window was typed as the empty string. Checked explicitly instead. The real lesson is the command: CI runs `pnpm build`, which is `tsc -b && vite build`. `tsc --noEmit` resolves a different project graph and `vite build` does no type checking at all, so running those two is not the same gate and passed over this. Run `pnpm format:check && pnpm lint && pnpm build` before pushing — which is what the workflow itself runs, verbatim. Nothing deployed from the failed run: `deploy-api` and `deploy-web` were both skipped, so the site stayed on a consistent pair. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Jp6a8EDar9ueEhAxzep4V5 --- web/src/lib/routes.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/lib/routes.ts b/web/src/lib/routes.ts index e62eedd..c51b687 100644 --- a/web/src/lib/routes.ts +++ b/web/src/lib/routes.ts @@ -128,7 +128,11 @@ function asWindow(segment: string | undefined): WindowName | null { // A link from before the rename. Resolved here rather than rejected, so an // address somebody shared still opens the page it named — `href` will then // write the block count back into the bar. - return (segment && LEGACY_WINDOWS[segment]) ?? null + // + // The empty segment is checked separately rather than leaning on `&&`: that + // form returns `''` for an empty path, which is neither a window nor null. + if (!segment) return null + return LEGACY_WINDOWS[segment] ?? null } /**