Add relative path prefix support to routeFor utilities#3292
Draft
Alex-Tideman wants to merge 2 commits intomainfrom
Draft
Add relative path prefix support to routeFor utilities#3292Alex-Tideman wants to merge 2 commits intomainfrom
Alex-Tideman wants to merge 2 commits intomainfrom
Conversation
Introduce a routePrefix store that allows consuming projects to inject
a path prefix (e.g., /projects/{projectId}) into all UI route functions.
The prefix is inserted between the SvelteKit base path and the route
path via a withPrefix helper that wraps the 12 root resolve() calls.
Leaf functions inherit the prefix automatically through the existing
string concatenation chain. Auth routes are excluded to avoid breaking
SSO flows.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
routePrefixmechanism viaCoreProviderthat allows consuming projects (e.g., Temporal Cloud) to inject a path prefix into all UI route functionswithPrefixhelper that inserts the prefix between the SvelteKitbasepath and the route path across the 12 rootresolve()calls — leaf functions inherit the prefix automatically through existing string concatenationrouteForAuthentication,routeForLoginPage) are explicitly excluded to avoid breaking SSO flowsgetRoutePrefixtoCoreProviderso the prefix is available globally and configured at initializationChanges
core-provider.ts: AddedgetRoutePrefixto theCoreProvidertype andInitOptions, with a default no-op returning''route-for.ts: AddedwithPrefix()helper wrapping all root route functions; auth routes left unwrappedhooks.client.ts: OSS init passesgetRoutePrefix: () => ''to maintain current behaviorroute-for.test.ts: Added test suite verifying prefix propagation through root, namespace, workflow, nexus, and schedule routes, plus exclusion from auth routesroute-for-base-path.test.ts: Added comprehensive parameterized tests covering allrouteForfunctions with prefix enabled, ensuringbase + prefixappears exactly once and auth routes remain prefix-freeTest plan
pnpm test -- --runpasses all new and existing route-for tests