From 74e3663d17bac45ce28cdf40adfb86708718bb3c Mon Sep 17 00:00:00 2001 From: "Marcelo M. Maciel" <4993482+marcelo-maciel@users.noreply.github.com> Date: Wed, 14 Oct 2026 18:21:14 -0300 Subject: [PATCH] fix(dashboard): welcome the tenant by its name on the overview The first-run heading and the header caption used the JWT tenant claim, which is the identifier. Read the name from the tenant status query the page already runs, falling back to the identifier while it is unavailable. Fixes #1436 --- clients/dashboard/src/pages/overview.tsx | 4 +++- clients/dashboard/tests/overview/overview.spec.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/clients/dashboard/src/pages/overview.tsx b/clients/dashboard/src/pages/overview.tsx index 6ad00991d7..f1a1b1d241 100644 --- a/clients/dashboard/src/pages/overview.tsx +++ b/clients/dashboard/src/pages/overview.tsx @@ -1046,7 +1046,9 @@ export function OverviewPage() { const firstName = (user?.name ?? user?.email?.split("@")[0] ?? "operator") .toString() .split(" ")[0]; - const tenantLabel = user?.tenant ?? "your tenant"; + // The JWT `tenant` claim is the identifier; the display name comes from the + // status query, so the id only shows while that is unavailable. + const tenantLabel = status.data?.name ?? user?.tenant ?? "your tenant"; // ── Stat values ─────────────────────────────────────────────────────── const planValue = subscription.isLoading ? ( diff --git a/clients/dashboard/tests/overview/overview.spec.ts b/clients/dashboard/tests/overview/overview.spec.ts index a0120b0ee6..eae5827e79 100644 --- a/clients/dashboard/tests/overview/overview.spec.ts +++ b/clients/dashboard/tests/overview/overview.spec.ts @@ -153,6 +153,15 @@ test.describe("overview (/)", () => { } }); + test("first-run panel welcomes the tenant by its name, not its identifier", async ({ page }) => { + // No subscription → first-run panel. The shell mock's status says tenant + // "acme" is named "Acme Corp"; the JWT only carries the identifier. + await mockJsonResponse(page, "**/api/v1/billing/subscriptions/me**", null); + await page.goto("/"); + await expect(page.getByRole("heading", { name: "Welcome to Acme Corp" })).toBeVisible(); + await expect(page.getByRole("heading", { name: "Welcome to acme", exact: true })).toHaveCount(0); + }); + test("Valid-for card reflects an in-grace tenant", async ({ page }) => { await mockJsonResponse(page, "**/api/v1/tenants/me/status**", { id: "acme",