-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
fix(dashboard): onboarding wizard uses connection.id (UUID), not connection.provider (category) - issue #6144 #6166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
diegosouzapw
merged 1 commit into
diegosouzapw:release/v3.8.45
from
KooshaPari:feat/6144-onboarding-id-redirect
Jul 5, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
33 changes: 33 additions & 0 deletions
33
src/app/(dashboard)/dashboard/providers/components/onboarding/providerOnboardingHref.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import type { OnboardingConnection } from "./providerOnboardingApi"; | ||
|
|
||
| export interface OnboardingSummaryAction { | ||
| href: string | null; | ||
| label: string; | ||
| } | ||
|
|
||
| /** | ||
| * Minimum surface area required to compute the dashboard details href. | ||
| * Accepts either a full {@link OnboardingConnection} or any partial that | ||
| * exposes the server-assigned UUID under `id`. | ||
| */ | ||
| export type HrefConnection = Pick<OnboardingConnection, "id"> & { | ||
| provider?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Build the "open provider details" link target for the onboarding wizard | ||
| * success card. The dashboard detail route is keyed by the connection's | ||
| * server-assigned UUID (`OnboardingConnection.id`), not by the provider | ||
| * category (`connection.provider` is e.g. "openai-compatible" and is shared | ||
| * across many connections). | ||
| * | ||
| * Returns `null` if no usable id is present so callers can hide the action | ||
| * entirely rather than linking to a 404. | ||
| */ | ||
| export function buildProviderDetailsHref( | ||
| connection: HrefConnection | null | undefined | ||
| ): string | null { | ||
| const id = connection?.id?.trim(); | ||
| if (!id) return null; | ||
| return `/dashboard/providers/${encodeURIComponent(id)}`; | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { test } from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
| import { buildProviderDetailsHref } from "../../src/app/(dashboard)/dashboard/providers/components/onboarding/providerOnboardingHref"; | ||
|
|
||
| test("buildProviderDetailsHref uses the server-assigned connection UUID", () => { | ||
| const href = buildProviderDetailsHref({ | ||
| id: "9f3c1a4d-1c2b-4a3c-8def-0123456789ab", | ||
| }); | ||
| assert.equal( | ||
| href, | ||
| "/dashboard/providers/9f3c1a4d-1c2b-4a3c-8def-0123456789ab" | ||
| ); | ||
| }); | ||
|
|
||
| test("buildProviderDetailsHref does not leak the provider category into the URL", () => { | ||
| // Regression for issue #6144: previously the wizard used | ||
| // `connection.provider` ("openai-compatible") as the URL slug, which 404'd | ||
| // on /dashboard/providers/[id] because that route is keyed by UUID. | ||
| const href = buildProviderDetailsHref({ | ||
| id: "9f3c1a4d-1c2b-4a3c-8def-0123456789ab", | ||
| provider: "openai-compatible", | ||
| }); | ||
| assert.notEqual(href, "/dashboard/providers/openai-compatible"); | ||
| assert.match(href ?? "", /\/dashboard\/providers\/[0-9a-f-]+$/); | ||
| }); | ||
|
|
||
| test("buildProviderDetailsHref returns null when no id is available", () => { | ||
| assert.equal(buildProviderDetailsHref(null), null); | ||
| assert.equal(buildProviderDetailsHref(undefined), null); | ||
| assert.equal(buildProviderDetailsHref({ id: "" }), null); | ||
| assert.equal(buildProviderDetailsHref({ id: " " }), null); | ||
| }); | ||
|
|
||
| test("buildProviderDetailsHref percent-encodes unusual ids", () => { | ||
| const href = buildProviderDetailsHref({ id: "abc/123 def" }); | ||
| assert.equal(href, "/dashboard/providers/abc%2F123%20def"); | ||
| }); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using an Immediately Invoked Function Expression (IIFE) inside JSX is generally an anti-pattern in React as it introduces unnecessary complexity and nesting. Since
buildProviderDetailsHrefis a lightweight, pure function, we can directly use a logical AND (&&) operator and a non-null assertion (!) to render the link cleanly without the IIFE wrapper.