From dde36c16826ce534ff3d4e0c403e373394693149 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 28 Nov 2026 19:20:54 +0000 Subject: [PATCH] fix(frontend): keep url helpers in their own chunk Fixes the release build and frontend checks. Co-Authored-By: Claude Opus 5.5 --- frontend/src/lib/utils/approvalResultUrls.ts | 6 +++++- frontend/vite.config.js | 15 ++++++++++++++- typescript-client/taskParams.ts | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/utils/approvalResultUrls.ts b/frontend/src/lib/utils/approvalResultUrls.ts index bd1e5b93ad..46c59b41ec 100644 --- a/frontend/src/lib/utils/approvalResultUrls.ts +++ b/frontend/src/lib/utils/approvalResultUrls.ts @@ -30,7 +30,11 @@ export function signedResumeUrl( ): string | undefined { const url = httpUrl(value, base) if (!url || url.hash || !SIGNED_PATH[op].test(url.pathname)) return undefined - if ([...url.searchParams.keys()].some((k) => k !== 'approver')) return undefined + let otherParam = false + url.searchParams.forEach((_, k) => { + if (k !== 'approver') otherParam = true + }) + if (otherParam) return undefined return url.href } diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 3f2befa0bc..189c1e3dc5 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -253,7 +253,13 @@ function assertAiEngineFreeAppShell() { generateBundle(_options, bundle) { if (!isClientBuild(bundle)) return for (const entry of entries) { - assertStaticClosureExcludes(this, bundle, entry, forbidden, 'sessionRuntimeRegistry.svelte.ts') + assertStaticClosureExcludes( + this, + bundle, + entry, + forbidden, + 'sessionRuntimeRegistry.svelte.ts' + ) } } } @@ -558,6 +564,13 @@ const config = { test: /[\\/]src[\\/]lib[\\/]gen[\\/]core[\\/]OpenAPI\.ts$/, priority: 1 }, + // Imported by the generated client and by the public app routes alike, and + // importing nothing: left alone they land in a chunk those routes may not load. + { + name: 'url-helpers', + test: /[\\/]src[\\/]lib[\\/](apiPathParams|navigationTarget)\.ts$/, + priority: 1 + }, { name: 'gen', test: /[\\/]src[\\/]lib[\\/]gen[\\/]/ } ] } diff --git a/typescript-client/taskParams.ts b/typescript-client/taskParams.ts index f5101342f0..94db65d46c 100644 --- a/typescript-client/taskParams.ts +++ b/typescript-client/taskParams.ts @@ -100,6 +100,7 @@ function skipRegex(src: string, start: number): number { /** * The names a v1 task job binds its arguments by, in order: the script parser names an * object pattern `anon`, and an array pattern has no name (`""`). + * @internal */ export function getParamNames(func: Function): string[] { const paramStr = parameterListSource(func.toString())?.trim();