The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Replace IndexRoute/IndexRedirect/Redirect with index routes and Navigate (#77591)
Romeo Van Snick803f470a7c68
diff --git a/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts b/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.tsindex 1c211ba1286..c8cc4b87c43 100644--- a/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts+++ b/e2e/test/scenarios/data-studio/transforms/transforms.cy.spec.ts@@ -4304,9 +4304,7 @@ describe("scenarios > data studio > transforms > permissions > oss", () => {.should("not.exist");cy.log("transform permissions should still not");- H.goToAdmin();- H.appBar().findByRole("link", { name: "Permissions" }).click();- cy.findByRole("menuitem", { name: "All Users" }).click();+ cy.visit(`/admin/permissions/data/group/${ALL_USERS_GROUP_ID}`);//Check that a known header is presentcy.findByRole("columnheader", { name: "Database name" }).should(@@ -4369,9 +4367,7 @@ describe(cy.button("Create a transform").should("be.visible");cy.log("transform permissions should now be visible");- H.goToAdmin();- H.appBar().findByRole("link", { name: "Permissions" }).click();- cy.findByRole("menuitem", { name: "All Users" }).click();+ cy.visit(`/admin/permissions/data/group/${ALL_USERS_GROUP_ID}`);//Check that a known header is presentcy.findByRole("columnheader", { name: "Database name" }).should(diff --git a/enterprise/frontend/src/metabase-enterprise/audit_app/metabot-analytics/routes.tsx b/enterprise/frontend/src/metabase-enterprise/audit_app/metabot-analytics/routes.tsxindex 5d52f368a7a..ca7217cc5ad 100644--- a/enterprise/frontend/src/metabase-enterprise/audit_app/metabot-analytics/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/audit_app/metabot-analytics/routes.tsx@@ -1,4 +1,4 @@-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { ConversationDetailPage } from "./components/ConversationDetailPage";import { ConversationStatsPage } from "./components/ConversationStatsPage";@@ -8,7 +8,7 @@ import { MetabotAnalyticsUpsellPage } from "./components/MetabotAnalyticsUpsellPexport function getAiAnalyticsRoutes() {return (<Route key="usage-auditing" path="usage-auditing">- <IndexRoute component={ConversationStatsPage} />+ <Route index component={ConversationStatsPage} /><Route path="conversations" component={ConversationsPage} /><Route path="conversations/:convoId" component={ConversationDetailPage} /></Route>diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/routes.tsx b/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/routes.tsxindex 4f220d066c9..7c13fec2ca4 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/routes.tsx@@ -1,5 +1,5 @@import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { DataStudioMetricAboutPage } from "./pages/DataStudioMetricAboutPage";import { DataStudioMetricDependenciesPage } from "./pages/DataStudioMetricDependenciesPage";@@ -20,7 +20,7 @@ export function getDataStudioMetricRoutes() {path=":cardId/dependencies"component={DataStudioMetricDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}<Route path=":cardId/history" component={DataStudioMetricHistoryPage} />diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/library/routes.tsx b/enterprise/frontend/src/metabase-enterprise/data-studio/library/routes.tsxindex ae51a688d72..2cfc425b74b 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/library/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/library/routes.tsx@@ -1,7 +1,7 @@import type { ComponentType } from "react";import { getDataStudioSegmentRoutes } from "metabase/data-studio/segments/routes";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { LibraryPage } from "./LibraryPage";import { LibrarySectionLayout } from "./LibrarySectionLayout";@@ -12,7 +12,7 @@ import { getDataStudioTableRoutes } from "./tables/routes";export const getDataStudioLibraryRoutes = (IsAdmin: ComponentType) => {return (<Route path="library" component={LibrarySectionLayout}>- <IndexRoute component={LibraryPage} />+ <Route index component={LibraryPage} />{getDataStudioTableRoutes(IsAdmin)}{getDataStudioMetricRoutes()}{getDataStudioSegmentRoutes()}diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/library/snippets/routes.tsx b/enterprise/frontend/src/metabase-enterprise/data-studio/library/snippets/routes.tsxindex 3b32a12f887..a5053779392 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/library/snippets/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/library/snippets/routes.tsx@@ -1,5 +1,5 @@import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { ArchivedSnippetsPage } from "./pages/ArchivedSnippetsPage";import { EditSnippetPage } from "./pages/EditSnippetPage";@@ -17,7 +17,7 @@ export function getDataStudioSnippetRoutes() {path="snippets/:snippetId/dependencies"component={SnippetDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}</>diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/routes.tsx b/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/routes.tsxindex 1fced952630..b4d75f058e4 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/routes.tsx@@ -9,7 +9,7 @@ import { PublishedTableSegmentDependenciesPage } from "metabase/data-studio/segmimport { PublishedTableSegmentDetailPage } from "metabase/data-studio/segments/pages/PublishedTableSegmentDetailPage";import { PublishedTableSegmentRevisionHistoryPage } from "metabase/data-studio/segments/pages/PublishedTableSegmentRevisionHistoryPage";import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { TableDependenciesPage } from "./pages/TableDependenciesPage";import { TableFieldsPage } from "./pages/TableFieldsPage";@@ -25,7 +25,7 @@ export function getDataStudioTableRoutes(IsAdmin: ComponentType) {<Route path=":tableId/fields/:fieldId" component={TableFieldsPage} /><Route path=":tableId/segments" component={TableSegmentsPage} /><Route path=":tableId/segments/new" component={IsAdmin}>- <IndexRoute component={PublishedTableNewSegmentPage} />+ <Route index component={PublishedTableNewSegmentPage} /></Route><Routepath=":tableId/segments/:segmentId"@@ -40,12 +40,12 @@ export function getDataStudioTableRoutes(IsAdmin: ComponentType) {path=":tableId/segments/:segmentId/dependencies"component={PublishedTableSegmentDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}<Route path=":tableId/measures" component={TableMeasuresPage} /><Route path=":tableId/measures/new" component={IsAdmin}>- <IndexRoute component={PublishedTableNewMeasurePage} />+ <Route index component={PublishedTableNewMeasurePage} /></Route><Routepath=":tableId/measures/:measureId"@@ -60,12 +60,12 @@ export function getDataStudioTableRoutes(IsAdmin: ComponentType) {path=":tableId/measures/:measureId/dependencies"component={PublishedTableMeasureDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}{PLUGIN_DEPENDENCIES.isEnabled && (<Route path=":tableId/dependencies" component={TableDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}</Route>diff --git a/enterprise/frontend/src/metabase-enterprise/database_routing/index.tsx b/enterprise/frontend/src/metabase-enterprise/database_routing/index.tsxindex b86493937b0..8c4bbf6fba5 100644--- a/enterprise/frontend/src/metabase-enterprise/database_routing/index.tsx+++ b/enterprise/frontend/src/metabase-enterprise/database_routing/index.tsx@@ -1,7 +1,7 @@import { t } from "ttag";import { PLUGIN_DB_ROUTING } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { hasPremiumFeature } from "metabase-enterprise/settings";import { DatabaseRoutingSection } from "./DatabaseRoutingSection";@@ -38,12 +38,12 @@ export function initializePlugin() {PLUGIN_DB_ROUTING.getDestinationDatabaseRoutes = (IsAdmin: any) => (<Route path="destination-databases">- <IndexRoute component={DestinationDatabasesModal} />+ <Route index component={DestinationDatabasesModal} /><Route component={IsAdmin}><Route path="create" component={DestinationDatabaseConnectionModal} /></Route><Route path=":destinationDatabaseId">- <IndexRoute component={DestinationDatabaseConnectionModal} />+ <Route index component={DestinationDatabaseConnectionModal} /><Route component={IsAdmin}><Route path="remove" component={RemoveDestinationDatabaseModal} /></Route>diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsxindex a760d38963d..6cb49215477 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/routes.tsx@@ -1,4 +1,4 @@-import { IndexRedirect, IndexRoute, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import {BrokenDependencyDiagnosticsPage,UnreferencedDependencyDiagnosticsPage,@@ -7,13 +7,13 @@ import {import { DependencyGraphPage } from "./pages/DependencyGraphPage";export function getDataStudioDependencyRoutes() {- return <IndexRoute component={DependencyGraphPage} />;+ return <Route index component={DependencyGraphPage} />;}export function getDataStudioDependencyDiagnosticsRoutes() {return (<>- <IndexRedirect to="broken" />+ <Route index component={redirect("broken")} /><Route path="broken" component={BrokenDependencyDiagnosticsPage} /><Routepath="unreferenced"diff --git a/enterprise/frontend/src/metabase-enterprise/schema_viewer/routes.tsx b/enterprise/frontend/src/metabase-enterprise/schema_viewer/routes.tsxindex 89b736cb975..56d5e92ae51 100644--- a/enterprise/frontend/src/metabase-enterprise/schema_viewer/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/schema_viewer/routes.tsx@@ -1,7 +1,7 @@-import { IndexRoute } from "metabase/router";+import { Route } from "metabase/router";import { SchemaViewerPage } from "./pages/SchemaViewerPage";export function getDataStudioSchemaViewerRoutes() {- return <IndexRoute component={SchemaViewerPage} />;+ return <Route index component={SchemaViewerPage} />;}diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/index.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/index.tsxindex 275e424f919..9df68350efb 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/index.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/index.tsx@@ -24,7 +24,7 @@ import {PLUGIN_TENANTS,} from "metabase/plugins";import { useSelector } from "metabase/redux";-import { IndexRedirect, IndexRoute, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import { getIsTenantUser, getUserIsAdmin } from "metabase/selectors/user";import { getApplicationName } from "metabase/selectors/whitelabel";import { Box, Text } from "metabase/ui";@@ -120,13 +120,13 @@ export function initializePlugin() {PLUGIN_TENANTS.tenantsRoutes = (<>- <IndexRoute component={TenantsListingApp} />+ <Route index component={TenantsListingApp} /><Route path="" component={TenantsListingApp}>{modalRoute("new", NewTenantModal, { noWrap: true })}{modalRoute("user-strategy", EditUserStrategyModal, { noWrap: true })}</Route><Route path="groups">- <IndexRoute component={ExternalGroupsListingApp} />+ <Route index component={ExternalGroupsListingApp} /><Route path=":groupId" component={ExternalGroupDetailApp} /></Route><Route path="people" component={ExternalPeopleListingApp}>@@ -140,7 +140,7 @@ export function initializePlugin() {},)}<Route path=":userId">- <IndexRedirect to="/admin/people/tenants/people" />+ <Route index component={redirect("/admin/people/tenants/people")} />{modalRoute("edit",(props) => (diff --git a/enterprise/frontend/src/metabase-enterprise/workspaces/routes.tsx b/enterprise/frontend/src/metabase-enterprise/workspaces/routes.tsxindex c2ea34739e4..1c84f781ca2 100644--- a/enterprise/frontend/src/metabase-enterprise/workspaces/routes.tsx+++ b/enterprise/frontend/src/metabase-enterprise/workspaces/routes.tsx@@ -1,4 +1,4 @@-import { IndexRoute, Route, type RouteComponent } from "metabase/router";+import { Route, type RouteComponent } from "metabase/router";import { AdminConnectionInfoPage } from "./pages/AdminConnectionInfoPage";import { WorkspaceIndexPage } from "./pages/WorkspaceIndexPage";@@ -6,7 +6,7 @@ import { WorkspaceIndexPage } from "./pages/WorkspaceIndexPage";export function getDataStudioRoutes() {return (<Route path="workspaces">- <IndexRoute component={WorkspaceIndexPage} />+ <Route index component={WorkspaceIndexPage} /></Route>);}diff --git a/frontend/src/metabase/account/routes.tsx b/frontend/src/metabase/account/routes.tsxindex d62a2f1ca9d..1409ede9d4a 100644--- a/frontend/src/metabase/account/routes.tsx+++ b/frontend/src/metabase/account/routes.tsx@@ -2,7 +2,7 @@ import type { Store } from "@reduxjs/toolkit";import { PLUGIN_MULTI_FACTOR_AUTH } from "metabase/plugins";import type { State } from "metabase/redux/store";-import { IndexRedirect, Route, type RouteComponent } from "metabase/router";+import { Route, type RouteComponent, redirect } from "metabase/router";import AccountApp from "./app/containers/AccountApp";import LoginHistoryApp from "./login-history/containers/LoginHistoryApp";@@ -17,7 +17,7 @@ export const getAccountRoutes = (return (<Route path="/account" component={IsAuthenticated}><Route component={AccountApp}>- <IndexRedirect to="profile" />+ <Route index component={redirect("profile")} /><Route path="profile" component={UserProfileApp} /><Route path="password" component={UserPasswordApp} /><Routediff --git a/frontend/src/metabase/admin/people/containers/AdminPeopleApp/AdminPeopleApp.unit.spec.tsx b/frontend/src/metabase/admin/people/containers/AdminPeopleApp/AdminPeopleApp.unit.spec.tsxindex dec302e6529..eb313b06a39 100644--- a/frontend/src/metabase/admin/people/containers/AdminPeopleApp/AdminPeopleApp.unit.spec.tsx+++ b/frontend/src/metabase/admin/people/containers/AdminPeopleApp/AdminPeopleApp.unit.spec.tsx@@ -9,7 +9,7 @@ import {createMockSettingsState,createMockState,} from "metabase/redux/store/mocks";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import type { EmbeddingHomepageStatus } from "metabase-types/api";import {createMockTokenFeatures,@@ -96,7 +96,7 @@ const setupTenantRoute = async (initialRoute: string) => {<Route path="tenants" component={createTenantsRouteGuard()}><Route path="groups" component={UpsellTenants} /><Route path="people" component={UpsellTenants} />- <IndexRoute component={UpsellTenants} />+ <Route index component={UpsellTenants} /></Route></Route>,{diff --git a/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx b/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsxindex c01d62289f7..c12b678f3d3 100644--- a/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx+++ b/frontend/src/metabase/admin/permissions/pages/DataPermissionsPage/DataPermissionsPage.tsx@@ -27,7 +27,7 @@ import { getDiff, getIsDirty } from "../../selectors/data-permissions/diff";type DataPermissionsPageProps = {children: ReactNode;- route: typeof Route;+ route: Route;params: {databaseId: DatabaseId;};diff --git a/frontend/src/metabase/admin/permissions/routes.tsx b/frontend/src/metabase/admin/permissions/routes.tsxindex e95cd2abb6b..4b1810eb963 100644--- a/frontend/src/metabase/admin/permissions/routes.tsx+++ b/frontend/src/metabase/admin/permissions/routes.tsx@@ -6,7 +6,7 @@ import {PLUGIN_ADMIN_PERMISSIONS_TABS,PLUGIN_APPLICATION_PERMISSIONS,} from "metabase/plugins";-import { IndexRedirect, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import { CollectionPermissionsPage } from "./pages/CollectionPermissionsPage/CollectionPermissionsPage";import DataPermissionsPage from "./pages/DataPermissionsPage";@@ -15,10 +15,10 @@ import { GroupsPermissionsPage } from "./pages/GroupDataPermissionsPage/GroupsPeconst getRoutes = () => (<Route>- <IndexRedirect to="data" />+ <Route index component={redirect("data")} /><Route path="data" component={DataPermissionsPage}>- <IndexRedirect to="group" />+ <Route index component={redirect("group")} /><Routepath="database(/:databaseId)(/schema/:schemaName)(/table/:tableId)"diff --git a/frontend/src/metabase/admin/routes.tsx b/frontend/src/metabase/admin/routes.tsxindex f1b88794946..9dd116408a2 100644--- a/frontend/src/metabase/admin/routes.tsx+++ b/frontend/src/metabase/admin/routes.tsx@@ -65,13 +65,7 @@ import {PerformanceTabId,} from "metabase/plugins";import type { State } from "metabase/redux/store";-import {- IndexRedirect,- IndexRoute,- Redirect,- Route,- type RouteComponent,-} from "metabase/router";+import { Route, type RouteComponent, redirect } from "metabase/router";import { getTokenFeature } from "metabase/selectors/settings";import { AISettingsPage, McpSettingsPage } from "./ai/AISettingsPage";@@ -98,9 +92,9 @@ export const getRoutes = (return (<Route path="/admin" component={CanAccessSettings}><Route component={AdminApp}>- <IndexRoute component={RedirectToAllowedSettings} />+ <Route index component={RedirectToAllowedSettings} /><Route path="databases" component={createAdminRouteGuard("databases")}>- <IndexRoute component={DatabaseListApp} />+ <Route index component={DatabaseListApp} /><Route component={IsAdmin}><Route path="create" component={DatabasePage} /></Route>@@ -113,7 +107,7 @@ export const getRoutes = (</Route><Route path="datamodel" component={createAdminRouteGuard("data-model")}><Route>- <IndexRedirect to="database" />+ <Route index component={redirect("database")} /><Route path="database" component={DataModelV1} /><Route path="database/:databaseId" component={DataModelV1} /><Route@@ -131,34 +125,38 @@ export const getRoutes = (<Route component={DataModelV1}><Route path="segments" component={SegmentListApp} /><Route path="segment/create" component={IsAdmin}>- <IndexRoute component={SegmentApp} />+ <Route index component={SegmentApp} /></Route><Route path="segment/:id" component={IsAdmin}>- <IndexRoute component={SegmentApp} />+ <Route index component={SegmentApp} /></Route><Routepath="segment/:id/revisions"component={RevisionHistoryApp}/></Route>- <Redirect- from="database/:databaseId/schema/:schemaId/table/:tableId/settings"- to="database/:databaseId/schema/:schemaId/table/:tableId"+ <Route+ path="database/:databaseId/schema/:schemaId/table/:tableId/settings"+ component={redirect(+ "database/:databaseId/schema/:schemaId/table/:tableId",+ )}/>- <Redirect- from="database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId/:section"- to="database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId"+ <Route+ path="database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId/:section"+ component={redirect(+ "database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId",+ )}/></Route></Route>{/* PEOPLE */}<Route path="people" component={createAdminRouteGuard("people")}><Route component={AdminPeopleApp}>- <IndexRoute component={PeopleListingApp} />+ <Route index component={PeopleListingApp} />{/*NOTE: this must come before the other routes otherwise it will be masked by them*/}<Route path="groups">- <IndexRoute component={GroupsListingApp} />+ <Route index component={GroupsListingApp} /><Route path=":groupId" component={GroupDetailApp} /></Route>@@ -166,7 +164,7 @@ export const getRoutes = (<Route path="tenants" component={createTenantsRouteGuard()}>{PLUGIN_TENANTS.tenantsRoutes ?? (<>- <IndexRoute component={UpsellTenants} />+ <Route index component={UpsellTenants} /><Route path="groups" component={UpsellTenants} /><Route path="people" component={UpsellTenants} /></>@@ -179,7 +177,7 @@ export const getRoutes = (</Route><Route path=":userId" component={PeopleListingApp}>- <IndexRedirect to="/admin/people" />+ <Route index component={redirect("/admin/people")} />{modalRoute("edit", EditUserModal, { noWrap: true })}{modalRoute("success", UserSuccessModal, { noWrap: true })}{modalRoute("reset", UserPasswordResetModal, { noWrap: true })}@@ -195,10 +193,10 @@ export const getRoutes = ({/* EMBEDDING */}<Route path="embedding" component={createAdminRouteGuard("embedding")}><Route component={AdminEmbeddingApp}>- <IndexRoute component={EmbeddingSettings} />+ <Route index component={EmbeddingSettings} /><Route path="setup-guide">- <IndexRoute component={EmbeddingHubAdminSettingsPage} />+ <Route index component={EmbeddingHubAdminSettingsPage} /><Routepath="permissions"@@ -221,27 +219,36 @@ export const getRoutes = ({/* OSS/Starter has all embedding settings on the same page */}{!hasSimpleEmbedding && (- <Redirect from="/admin/embedding/guest" to="/admin/embedding" />+ <Route+ path="/admin/embedding/guest"+ component={redirect("/admin/embedding")}+ />)}{/* Backwards compatibility for embedding settings */}- <Redirect from="/admin/embedding/modular" to="/admin/embedding" />- <Redirect from="/admin/embedding/interactive" to="/admin/embedding" />- <Redirect- from="/admin/settings/embedding-in-other-applications"- to="/admin/embedding"+ <Route+ path="/admin/embedding/modular"+ component={redirect("/admin/embedding")}/>- <Redirect- from="/admin/settings/embedding-in-other-applications/full-app"- to="/admin/embedding"+ <Route+ path="/admin/embedding/interactive"+ component={redirect("/admin/embedding")}+ />+ <Route+ path="/admin/settings/embedding-in-other-applications"+ component={redirect("/admin/embedding")}/>- <Redirect- from="/admin/settings/embedding-in-other-applications/standalone"- to="/admin/embedding/guest"+ <Route+ path="/admin/settings/embedding-in-other-applications/full-app"+ component={redirect("/admin/embedding")}/>- <Redirect- from="/admin/settings/embedding-in-other-applications/sdk"- to="/admin/embedding"+ <Route+ path="/admin/settings/embedding-in-other-applications/standalone"+ component={redirect("/admin/embedding/guest")}+ />+ <Route+ path="/admin/settings/embedding-in-other-applications/sdk"+ component={redirect("/admin/embedding")}/>{/* SETTINGS */}@@ -259,7 +266,7 @@ export const getRoutes = (component={createAdminRouteGuard("performance")}><Route component={PerformanceApp}>- <IndexRedirect to={PerformanceTabId.Databases} />+ <Route index component={redirect(PerformanceTabId.Databases)} /><Route path="databases" component={StrategyEditorForDatabases} /><Route path="models" component={ModelPersistenceConfiguration} /><Route@@ -274,7 +281,7 @@ export const getRoutes = ({PLUGIN_AUDIT.getAiAnalyticsRoutes()}{PLUGIN_AUDIT.getMcpAnalyticsRoutes()}<Route key="index-layout" component={MetabotAdminLayout}>- <IndexRoute key="index" component={AISettingsPage} />+ <Route index key="index" component={AISettingsPage} /><Route key="mcp" path="mcp" component={McpSettingsPage} /></Route><Route@@ -318,7 +325,7 @@ export const getRoutes = (<Route path="tools" component={createAdminRouteGuard("tools")}><Route component={ToolsApp}>- <IndexRedirect to="help" />+ <Route index component={redirect("help")} /><Routekey="error-overview"path="errors"diff --git a/frontend/src/metabase/admin/settingsRoutes.tsx b/frontend/src/metabase/admin/settingsRoutes.tsxindex 7ef9f01d8c8..0b8e6fbbcfb 100644--- a/frontend/src/metabase/admin/settingsRoutes.tsx+++ b/frontend/src/metabase/admin/settingsRoutes.tsx@@ -7,12 +7,7 @@ import {PLUGIN_TRANSFORMS_PYTHON,} from "metabase/plugins";import type { State } from "metabase/redux/store";-import {- IndexRedirect,- IndexRoute,- Route,- type RouteComponent,-} from "metabase/router";+import { Route, type RouteComponent, redirect } from "metabase/router";import { getSetting } from "metabase/selectors/settings";import { GoogleAuthForm } from "./settings/auth/components/GoogleAuthForm";@@ -55,7 +50,7 @@ export const getSettingsRoutes = (</AdminSettingsLayout>)}>- <IndexRedirect to="general" />+ <Route index component={redirect("general")} /><Route path="general" component={GeneralSettingsPage} /><Route path="updates" component={UpdatesSettingsPage} /><Route path="email" component={EmailSettingsPage} />@@ -95,7 +90,7 @@ export const getSettingsRoutes = (/* do not allow users with "Settings access" permissions to access custom viz pages */component={IsAdmin}>- <IndexRoute component={CustomVisualizationsManagePage} />+ <Route index component={CustomVisualizationsManagePage} /><Route path="new" component={CustomVisualizationsFormPage} /><Route path="edit/:id" component={CustomVisualizationsFormPage} />{devModeEnabled && (diff --git a/frontend/src/metabase/data-studio/data-model/pages/DataModel/DataModel.unit.spec.tsx b/frontend/src/metabase/data-studio/data-model/pages/DataModel/DataModel.unit.spec.tsxindex 9f6aa6ba2b1..dc68cbf04fe 100644--- a/frontend/src/metabase/data-studio/data-model/pages/DataModel/DataModel.unit.spec.tsx+++ b/frontend/src/metabase/data-studio/data-model/pages/DataModel/DataModel.unit.spec.tsx@@ -24,7 +24,7 @@ import {within,} from "__support__/ui";import { getRawTableFieldId } from "metabase/metadata/utils/field";-import { IndexRedirect, Link, Redirect, Route } from "metabase/router";+import { Link, Route, redirect } from "metabase/router";import * as Urls from "metabase/urls";import { checkNotNull } from "metabase/utils/types";import { registerVisualizations } from "metabase/visualizations/register";@@ -256,16 +256,18 @@ async function setup({<><Route path="notData" component={OtherComponent} /><Route path="data-studio/data">- <IndexRedirect to="database" />+ <Route index component={redirect("database")} /><Route path="database" component={DataModel} /><Route path="database/:databaseId" component={DataModel} /><Routepath="database/:databaseId/schema/:schemaId"component={DataModel}/>- <Redirect- from="database/:databaseId/schema/:schemaId/table/:tableId"- to="database/:databaseId/schema/:schemaId/table/:tableId/details"+ <Route+ path="database/:databaseId/schema/:schemaId/table/:tableId"+ component={redirect(+ "database/:databaseId/schema/:schemaId/table/:tableId/details",+ )}/><Routepath="database/:databaseId/schema/:schemaId/table/:tableId/:tab"diff --git a/frontend/src/metabase/data-studio/data-model/routes.tsx b/frontend/src/metabase/data-studio/data-model/routes.tsxindex 2349e2478f3..8b4d3ec938c 100644--- a/frontend/src/metabase/data-studio/data-model/routes.tsx+++ b/frontend/src/metabase/data-studio/data-model/routes.tsx@@ -9,14 +9,14 @@ import { DataModelSegmentDependenciesPage } from "metabase/data-studio/segments/import { DataModelSegmentDetailPage } from "metabase/data-studio/segments/pages/DataModelSegmentDetailPage";import { DataModelSegmentRevisionHistoryPage } from "metabase/data-studio/segments/pages/DataModelSegmentRevisionHistoryPage";import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Redirect, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import { DataModel } from "./pages/DataModel";export function getDataStudioMetadataRoutes(IsAdmin: ComponentType) {return (<>- <IndexRoute component={DataModel} />+ <Route index component={DataModel} /><Route path="database" component={DataModel} /><Route path="database/:databaseId" component={DataModel} /><Route@@ -31,7 +31,7 @@ export function getDataStudioMetadataRoutes(IsAdmin: ComponentType) {path="database/:databaseId/schema/:schemaId/table/:tableId/segments/new"component={IsAdmin}>- <IndexRoute component={DataModelNewSegmentPage} />+ <Route index component={DataModelNewSegmentPage} /></Route><Routepath="database/:databaseId/schema/:schemaId/table/:tableId/segments/:segmentId"@@ -46,14 +46,14 @@ export function getDataStudioMetadataRoutes(IsAdmin: ComponentType) {path="database/:databaseId/schema/:schemaId/table/:tableId/segments/:segmentId/dependencies"component={DataModelSegmentDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}<Routepath="database/:databaseId/schema/:schemaId/table/:tableId/measures/new"component={IsAdmin}>- <IndexRoute component={DataModelNewMeasurePage} />+ <Route index component={DataModelNewMeasurePage} /></Route><Routepath="database/:databaseId/schema/:schemaId/table/:tableId/measures/:measureId"@@ -68,12 +68,14 @@ export function getDataStudioMetadataRoutes(IsAdmin: ComponentType) {path="database/:databaseId/schema/:schemaId/table/:tableId/measures/:measureId/dependencies"component={DataModelMeasureDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}- <Redirect- from="database/:databaseId/schema/:schemaId/table/:tableId"- to="database/:databaseId/schema/:schemaId/table/:tableId/details"+ <Route+ path="database/:databaseId/schema/:schemaId/table/:tableId"+ component={redirect(+ "database/:databaseId/schema/:schemaId/table/:tableId/details",+ )}/><Routepath="database/:databaseId/schema/:schemaId/table/:tableId/:tab"@@ -83,13 +85,17 @@ export function getDataStudioMetadataRoutes(IsAdmin: ComponentType) {path="database/:databaseId/schema/:schemaId/table/:tableId/:tab/:fieldId"component={DataModel}/>- <Redirect- from="database/:databaseId/schema/:schemaId/table/:tableId/settings"- to="database/:databaseId/schema/:schemaId/table/:tableId/details"+ <Route+ path="database/:databaseId/schema/:schemaId/table/:tableId/settings"+ component={redirect(+ "database/:databaseId/schema/:schemaId/table/:tableId/details",+ )}/>- <Redirect- from="database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId/:section"- to="database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId"+ <Route+ path="database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId/:section"+ component={redirect(+ "database/:databaseId/schema/:schemaId/table/:tableId/field/:fieldId",+ )}/></>);diff --git a/frontend/src/metabase/data-studio/measures/routes.tsx b/frontend/src/metabase/data-studio/measures/routes.tsxindex e52b57157e0..0022ad4081b 100644--- a/frontend/src/metabase/data-studio/measures/routes.tsx+++ b/frontend/src/metabase/data-studio/measures/routes.tsx@@ -1,5 +1,5 @@import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { MeasureDependenciesPage } from "./pages/MeasureDependenciesPage";import { MeasureDetailPage } from "./pages/MeasureDetailPage";@@ -17,7 +17,7 @@ export function getDataStudioMeasureRoutes() {path=":measureId/dependencies"component={MeasureDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}</Route>diff --git a/frontend/src/metabase/data-studio/routes.tsx b/frontend/src/metabase/data-studio/routes.tsxindex fbf2cba3fbe..1e3d5628f6b 100644--- a/frontend/src/metabase/data-studio/routes.tsx+++ b/frontend/src/metabase/data-studio/routes.tsx@@ -9,12 +9,7 @@ import {} from "metabase/plugins";import { useSelector } from "metabase/redux";import type { State } from "metabase/redux/store";-import {- IndexRoute,- Navigate,- Route,- type RouteComponent,-} from "metabase/router";+import { Navigate, Route, type RouteComponent } from "metabase/router";import { getDataStudioTransformRoutes } from "metabase/transforms/routes";import { canAccessTransforms } from "metabase/transforms/selectors";import * as Urls from "metabase/urls";@@ -42,7 +37,7 @@ export function getDataStudioRoutes(return (<Route component={CanAccessDataStudio}><Route path="data-studio" component={DataStudioLayout}>- <IndexRoute component={DataStudioIndexRedirect} />+ <Route index component={DataStudioIndexRedirect} /><Route path="data" component={CanAccessDataModel}><Route component={DataSectionLayout}>{getDataStudioMetadataRoutes(IsAdmin)}diff --git a/frontend/src/metabase/data-studio/segments/routes.tsx b/frontend/src/metabase/data-studio/segments/routes.tsxindex 05d51011be9..e238e8b4c67 100644--- a/frontend/src/metabase/data-studio/segments/routes.tsx+++ b/frontend/src/metabase/data-studio/segments/routes.tsx@@ -1,5 +1,5 @@import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { NewSegmentPage } from "./pages/NewSegmentPage";import { SegmentDependenciesPage } from "./pages/SegmentDependenciesPage";@@ -17,7 +17,7 @@ export function getDataStudioSegmentRoutes() {path=":segmentId/dependencies"component={SegmentDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}</Route>diff --git a/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.unit.spec.tsx b/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.unit.spec.tsxindex aa3893cded0..3f974373e7a 100644--- a/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.unit.spec.tsx+++ b/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.unit.spec.tsx@@ -21,7 +21,7 @@ import {} from "__support__/ui";import { getNextId } from "__support__/utils";import { getRawTableFieldId } from "metabase/metadata/utils/field";-import { IndexRedirect, Link, Route } from "metabase/router";+import { Link, Route, redirect } from "metabase/router";import * as Urls from "metabase/urls";import { checkNotNull } from "metabase/utils/types";import { registerVisualizations } from "metabase/visualizations/register";@@ -218,7 +218,7 @@ async function setup({<><Route path="notAdmin" component={OtherComponent} /><Route path="admin/datamodel">- <IndexRedirect to="database" />+ <Route index component={redirect("database")} /><Route path="database" component={DataModelV1} /><Route path="database/:databaseId" component={DataModelV1} /><Routediff --git a/frontend/src/metabase/metrics/routes.tsx b/frontend/src/metabase/metrics/routes.tsxindex 823553e3971..ca30a9f662e 100644--- a/frontend/src/metabase/metrics/routes.tsx+++ b/frontend/src/metabase/metrics/routes.tsx@@ -1,5 +1,5 @@import { PLUGIN_DEPENDENCIES } from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { MetricAboutPage } from "./pages/MetricAboutPage";import { MetricDependenciesPage } from "./pages/MetricDependenciesPage";@@ -17,7 +17,7 @@ export function getMetricRoutes() {<Route path=":cardId/query" component={MetricQueryPage} />{PLUGIN_DEPENDENCIES.isEnabled && (<Route path=":cardId/dependencies" component={MetricDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}<Route path=":cardId/history" component={MetricHistoryPage} />diff --git a/frontend/src/metabase/models/containers/ModelActions/ModelActions.unit.spec.tsx b/frontend/src/metabase/models/containers/ModelActions/ModelActions.unit.spec.tsxindex 56f0c5606ac..742ef14ad4d 100644--- a/frontend/src/metabase/models/containers/ModelActions/ModelActions.unit.spec.tsx+++ b/frontend/src/metabase/models/containers/ModelActions/ModelActions.unit.spec.tsx@@ -23,7 +23,7 @@ import {createMockSettingsState,createMockState,} from "metabase/redux/store/mocks";-import { IndexRedirect, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import * as Urls from "metabase/urls";import { checkNotNull } from "metabase/utils/types";import { TYPE } from "metabase-lib/v1/types/constants";@@ -222,7 +222,7 @@ async function setup({const { history } = renderWithProviders(<><Route path="/model/:slug/detail">- <IndexRedirect to="actions" />+ <Route index component={redirect("actions")} /><Route path="actions" component={ModelActions}>{modalRoute("new", ActionCreator, {modalProps: { transitionProps: { duration: 0 } },diff --git a/frontend/src/metabase/models/routes.tsx b/frontend/src/metabase/models/routes.tsxindex de2c2dad07e..e4185fc5063 100644--- a/frontend/src/metabase/models/routes.tsx+++ b/frontend/src/metabase/models/routes.tsx@@ -2,7 +2,7 @@ import ActionCreatorModal from "metabase/actions/containers/ActionCreatorModal/Aimport { modalRoute } from "metabase/common/components/ModalRoute";import { ModelDetailPage } from "metabase/detail-view/pages/ModelDetailPage/ModelDetailPage";import ModelActions from "metabase/models/containers/ModelActions/ModelActions";-import { IndexRedirect, Redirect, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import {type ModalProps,PREVENT_AUTOCOMPLETE_CLIPPING_MODAL_PROPS,@@ -20,10 +20,10 @@ export const getRoutes = () => {{modalRoute(":actionId", ActionCreatorModal, { modalProps })}</Route><Route path=":rowId" component={ModelDetailPage} />- <IndexRedirect to="actions" />- <Redirect from="usage" to="actions" />- <Redirect from="schema" to="actions" />- <Redirect from="*" to="actions" />+ <Route index component={redirect("actions")} />+ <Route path="usage" component={redirect("actions")} />+ <Route path="schema" component={redirect("actions")} />+ <Route path="*" component={redirect("actions")} /></Route>);};diff --git a/frontend/src/metabase/monitor/tools/notifications/routes.tsx b/frontend/src/metabase/monitor/tools/notifications/routes.tsxindex 5442b7a867c..7c19d991090 100644--- a/frontend/src/metabase/monitor/tools/notifications/routes.tsx+++ b/frontend/src/metabase/monitor/tools/notifications/routes.tsx@@ -1,10 +1,10 @@-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { NotificationsAdminPage } from "./NotificationsAdminPage";export const getRoutes = () => (<>- <IndexRoute component={NotificationsAdminPage} />+ <Route index component={NotificationsAdminPage} /><Route path=":notificationId" component={NotificationsAdminPage} /></>);diff --git a/frontend/src/metabase/monitor/tools/routes.tsx b/frontend/src/metabase/monitor/tools/routes.tsxindex ec5d97d14ab..5a4dbc512a3 100644--- a/frontend/src/metabase/monitor/tools/routes.tsx+++ b/frontend/src/metabase/monitor/tools/routes.tsx@@ -1,4 +1,4 @@-import { IndexRedirect, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import { TaskDetailsPage } from "./components/TaskDetailsPage";import { TaskListPage } from "./components/TaskListPage";@@ -7,7 +7,7 @@ import { TaskRunsPage } from "./components/TaskRunsPage";export const getTasksRoutes = () => (<>- <IndexRedirect to="list" />+ <Route index component={redirect("list")} /><Route path="list" component={TaskListPage} /><Route path="list/:taskId" component={TaskDetailsPage} /><Route path="runs" component={TaskRunsPage} />diff --git a/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.styled.tsx b/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.styled.tsxindex 686182239a6..1433c072446 100644--- a/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.styled.tsx+++ b/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.styled.tsx@@ -40,7 +40,6 @@ export const SearchInputContainer = styled.div<{}return css`background-color: var(--mb-color-background_page-primary);-&:hover {background-color: var(--mb-color-background_page-secondary);}diff --git a/frontend/src/metabase/query_builder/containers/test-utils.tsx b/frontend/src/metabase/query_builder/containers/test-utils.tsxindex 4b44f485999..a56b2d7e5c6 100644--- a/frontend/src/metabase/query_builder/containers/test-utils.tsx+++ b/frontend/src/metabase/query_builder/containers/test-utils.tsx@@ -36,7 +36,7 @@ import { NewItemMenu } from "metabase/common/components/NewItemMenu";import { LOAD_COMPLETE_FAVICON } from "metabase/common/hooks/constants";import { serializeCardForUrl } from "metabase/common/utils/card";import { createMockState } from "metabase/redux/store/mocks";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { checkNotNull } from "metabase/utils/types";import type { Card, Dataset, Timeline, UnsavedCard } from "metabase-types/api";import {@@ -300,7 +300,7 @@ export const setup = async ({<Route path=":slug/notebook" component={TestQueryBuilder} /></Route><Route path="/question">- <IndexRoute component={TestQueryBuilder} />+ <Route index component={TestQueryBuilder} /><Route path="notebook" component={TestQueryBuilder} /><Route path=":slug" component={TestQueryBuilder} /><Route path=":slug/notebook" component={TestQueryBuilder} />diff --git a/frontend/src/metabase/router/Link.unit.spec.tsx b/frontend/src/metabase/router/Link.unit.spec.tsxindex 603e6ed2ceb..11cd3c88e70 100644--- a/frontend/src/metabase/router/Link.unit.spec.tsx+++ b/frontend/src/metabase/router/Link.unit.spec.tsx@@ -1,7 +1,7 @@import { renderWithProviders, screen } from "__support__/ui";import { Link } from "./Link";-import { Route } from "./react-router";+import { Route } from "./route";describe("router/Link", () => {it("re-exports the to-based Link", () => {diff --git a/frontend/src/metabase/router/Navigate.unit.spec.tsx b/frontend/src/metabase/router/Navigate.unit.spec.tsxindex bf6addb6b31..cdebffa5b0a 100644--- a/frontend/src/metabase/router/Navigate.unit.spec.tsx+++ b/frontend/src/metabase/router/Navigate.unit.spec.tsx@@ -4,7 +4,7 @@ import { useState } from "react";import { act, renderWithProviders, screen, waitFor } from "__support__/ui";import { Navigate } from "./Navigate";-import { Route } from "./react-router";+import { Route } from "./route";// Stable references: `<Navigate>` keeps `state` raw in its effect deps (like v7),// so a fresh object literal each render would re-navigate and loop.diff --git a/frontend/src/metabase/router/RouterProvider.tsx b/frontend/src/metabase/router/RouterProvider.tsxindex 88d9dc37e99..0b31640415e 100644--- a/frontend/src/metabase/router/RouterProvider.tsx+++ b/frontend/src/metabase/router/RouterProvider.tsx@@ -3,12 +3,8 @@ import { type PropsWithChildren, createContext } from "react";import { useHistory } from "metabase/history";-import {- Route,- Router,- type WithRouterProps,- withRouter,-} from "./react-router";+import { Router, type WithRouterProps, withRouter } from "./react-router";+import { Route } from "./route";type RouterContextType = WithRouterProps;diff --git a/frontend/src/metabase/router/guards.unit.spec.tsx b/frontend/src/metabase/router/guards.unit.spec.tsxindex d5e8e88999a..7559fa7a0c2 100644--- a/frontend/src/metabase/router/guards.unit.spec.tsx+++ b/frontend/src/metabase/router/guards.unit.spec.tsx@@ -13,7 +13,7 @@ import {IsNotAuthenticated,isBackendOnlyPath,} from "./guards";-import { Route } from "./react-router";+import { Route } from "./route";jest.mock("metabase/utils/dom", () => ({...jest.requireActual("metabase/utils/dom"),diff --git a/frontend/src/metabase/router/index.ts b/frontend/src/metabase/router/index.tsindex 90c51d0d36f..8eb1c6a7c41 100644--- a/frontend/src/metabase/router/index.ts+++ b/frontend/src/metabase/router/index.ts@@ -3,6 +3,8 @@ export * from "./middleware";export * from "./navigation";export * from "./Navigate";export * from "./react-router";+export * from "./redirect";+export * from "./route";export * from "./Outlet";export * from "./routing-reducer";export * from "./sync";diff --git a/frontend/src/metabase/router/react-router.ts b/frontend/src/metabase/router/react-router.tsindex c409ea56ba1..29168bf5b46 100644--- a/frontend/src/metabase/router/react-router.ts+++ b/frontend/src/metabase/router/react-router.ts@@ -2,24 +2,23 @@// of the app reaches these symbols through `metabase/router`, so later phases can// swap the engine behind this seam without touching call sites.//-// The v7-shaped API (useNavigate, useLocation, Link, Navigate, Outlet, ...) lives-// in the sibling facade modules. This file only re-exports the raw v3 symbols that-// have not been given a v7 shape yet (route-tree components, withRouter, history-// helpers) plus the raw Link/LinkProps under `Router`-prefixed names for the few-// call sites that need the unstyled primitive.-import type { ComponentClass } from "react";-import type {- IndexRouteProps as BaseIndexRouteProps,- RouteProps as BaseRouteProps,-} from "react-router";-import { IndexRoute as BaseIndexRoute, Route as BaseRoute } from "react-router";+// The v7-shaped API (useNavigate, useLocation, Link, Navigate, Outlet, Route, ...)+// lives in the sibling facade modules. This file only re-exports the raw v3 symbols+// that have not been given a v7 shape yet (withRouter, history helpers, the route+// builders the `Route`/`redirect` shims are built on) plus the raw Link/LinkProps+// under `Router`-prefixed names for the few call sites that need the unstyled+// primitive.+import type { RouteProps as BaseRouteProps } from "react-router";export {- IndexRedirect,Link as RouterLink,- Redirect,+ // The raw v3 `<Route>`, used by the `Route` shim to run v3's route builder over+ // a `<Route index>` element without recursing back into the shim's own builder.+ Route as ReactRouterRoute,Router,createMemoryHistory,+ createRoutes,+ formatPattern,useRouterHistory,withRouter,} from "react-router";@@ -46,13 +45,3 @@ export type {type LifecycleHook = "onEnter" | "onChange" | "onLeave";export type RouteProps = Omit<BaseRouteProps, LifecycleHook>;-export type IndexRouteProps = Omit<BaseIndexRouteProps, LifecycleHook>;--// `react-router` exports each of these as both a value and a type, so mirror that.-export type Route = ComponentClass<RouteProps>;-// Unjustified type cast. FIXME-export const Route = BaseRoute as Route;--export type IndexRoute = ComponentClass<IndexRouteProps>;-// Unjustified type cast. FIXME-export const IndexRoute = BaseIndexRoute as IndexRoute;diff --git a/frontend/src/metabase/router/redirect.tsx b/frontend/src/metabase/router/redirect.tsxnew file mode 100644index 00000000000..d6fc48a95d7--- /dev/null+++ b/frontend/src/metabase/router/redirect.tsx@@ -0,0 +1,80 @@+import type { ComponentType } from "react";+import { useState } from "react";++import { Navigate } from "./Navigate";+import { type PlainRoute, formatPattern } from "./react-router";+import { useRouter } from "./use-router";++type RouteParams = Record<string, string | undefined>;++/**+ * Reproduces react-router v3's `<Redirect>` as a v7-style redirecting component.+ * Mounted as a route `component`, it interpolates `:params` and the `*` splat+ * into `to`, resolves a relative `to` against the parent route (using v3's own+ * matched-route resolution, so encoding and splats behave identically), and+ * preserves the current query string and history state (dropping the hash, as v3+ * did). It collapses to a bare `<Navigate>` once the engine swap supplies native+ * relative resolution.+ */+export function redirect(to: string): ComponentType {+ return function RedirectRoute(): JSX.Element {+ const { routes, params, location } = useRouter();++ // Resolve the target once, from the match this redirect was rendered into.+ // The router context is shared and updates as soon as the redirect fires, so+ // a later render (before this component unmounts) would resolve a relative+ // `to` against the already-changed, deeper location. v3's <Redirect> computed+ // its target once in `onEnter`, so freeze it here to match.+ const [target] = useState(() => ({+ pathname: resolveTarget(to, routes, params),+ search: location.search,+ state: location.state,+ }));++ return (+ <Navigate+ to={{ pathname: target.pathname, search: target.search }}+ state={target.state}+ replace+ />+ );+ };+}++/**+ * The redirect target, computed the way v3's `<Redirect>` did in its `onEnter`:+ * an absolute `to` is filled directly, a relative one is resolved against the+ * pattern of the parent of the matched (leaf) redirect route.+ */+function resolveTarget(+ to: string,+ routes: PlainRoute[],+ params: RouteParams,+): string {+ if (to.startsWith("/")) {+ return formatPattern(to, params);+ }+ const parentPattern = getRoutePattern(routes, routes.length - 2);+ const pattern = parentPattern.replace(/\/*$/, "/") + to;+ return formatPattern(pattern, params);+}++/**+ * The absolute pattern up to and including `routes[routeIndex]`, walking parents+ * until an absolute segment. Ported from v3's `Redirect.getRoutePattern`.+ */+function getRoutePattern(routes: PlainRoute[], routeIndex: number): string {+ let parentPattern = "";++ for (let i = routeIndex; i >= 0; i--) {+ const pattern = routes[i].path || "";++ parentPattern = pattern.replace(/\/*$/, "/") + parentPattern;++ if (pattern.indexOf("/") === 0) {+ break;+ }+ }++ return "/" + parentPattern;+}diff --git a/frontend/src/metabase/router/redirect.unit.spec.tsx b/frontend/src/metabase/router/redirect.unit.spec.tsxnew file mode 100644index 00000000000..1df7c8c79dc--- /dev/null+++ b/frontend/src/metabase/router/redirect.unit.spec.tsx@@ -0,0 +1,172 @@+import type { PropsWithChildren } from "react";++import { renderWithProviders, screen, waitFor } from "__support__/ui";++import { redirect } from "./redirect";+import { Route } from "./route";++const Parent = ({ children }: PropsWithChildren) => <div>{children}</div>;+const DataLayout = ({ children }: PropsWithChildren) => (+ <div>+ <aside data-testid="perm-side">side</aside>+ {children}+ </div>+);+const GroupPage = () => <div>group page</div>;++function mountRoutes(tree: JSX.Element, initialRoute: string) {+ const { history } = renderWithProviders(tree, {+ withRouter: true,+ initialRoute,+ });+ return history;+}++describe("router/redirect", () => {+ it("resolves a chained two-level index redirect (permissions repro)", async () => {+ const history = mountRoutes(+ <Route path="/admin">+ <Route path="permissions" component={Parent}>+ <Route>+ <Route index component={redirect("data")} />+ <Route path="data" component={DataLayout}>+ <Route index component={redirect("group")} />+ <Route path="group" component={GroupPage} />+ </Route>+ </Route>+ </Route>+ </Route>,+ "/admin/permissions",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe(+ "/admin/permissions/data/group",+ ),+ );+ expect(await screen.findByTestId("perm-side")).toBeInTheDocument();+ expect(await screen.findByText("group page")).toBeInTheDocument();+ });++ it("redirects to an absolute target", async () => {+ const history = mountRoutes(+ <Route path="start" component={redirect("/browse/models")} />,+ "/start",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe("/browse/models"),+ );+ });++ it("resolves a relative target against the parent of the `from` match", async () => {+ const history = mountRoutes(+ <Route path="collection" component={Parent}>+ <Route path="archive" component={redirect("trash")} />+ </Route>,+ "/collection/archive",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe("/collection/trash"),+ );+ });++ it("interpolates params into a relative target", async () => {+ const history = mountRoutes(+ <Route path="browse" component={Parent}>+ <Route+ path=":dbId-:slug"+ component={redirect("databases/:dbId-:slug")}+ />+ </Route>,+ "/browse/5-orders",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe(+ "/browse/databases/5-orders",+ ),+ );+ });++ it("resolves a relative target under a multi-segment `from`", async () => {+ const from = "table/:tableId/field/:fieldId/:section";+ const to = "table/:tableId/field/:fieldId";+ const history = mountRoutes(+ <Route path="model" component={Parent}>+ <Route path={from} component={redirect(to)} />+ </Route>,+ "/model/table/9/field/3/settings",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe(+ "/model/table/9/field/3",+ ),+ );+ });++ it("resolves against the route tree, re-encoding params like v3", async () => {+ const from = "database/:databaseId/schema/:schemaId/table/:tableId";+ const to = `${from}/details`;+ const history = mountRoutes(+ <Route path="data-studio/data" component={Parent}>+ <Route path={from} component={redirect(to)} />+ </Route>,+ // `1:PUBLIC` arrives encoded as `1%3APUBLIC`+ "/data-studio/data/database/1/schema/1%3APUBLIC/table/2",+ );++ // v3's formatPattern re-encodes the interpolated param, so the target keeps+ // the encoded schema segment rather than doubling the path.+ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe(+ "/data-studio/data/database/1/schema/1%3APUBLIC/table/2/details",+ ),+ );+ });++ it("carries the splat into an absolute target", async () => {+ const history = mountRoutes(+ <Route+ path="admin/transforms/*"+ component={redirect("/data-studio/transforms/*")}+ />,+ "/admin/transforms/jobs/7",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe(+ "/data-studio/transforms/jobs/7",+ ),+ );+ });++ it("redirects from an index route to a relative sibling of the parent", async () => {+ const history = mountRoutes(+ <Route path="tools" component={Parent}>+ <Route index component={redirect("list")} />+ </Route>,+ "/tools",+ );++ await waitFor(() =>+ expect(history?.getCurrentLocation().pathname).toBe("/tools/list"),+ );+ });++ it("preserves the query string and drops the hash, like v3", async () => {+ const history = mountRoutes(+ <Route path="start" component={redirect("/dest")} />,+ "/start?foo=bar#frag",+ );++ await waitFor(() => {+ const location = history?.getCurrentLocation();+ expect(location?.pathname).toBe("/dest");+ expect(location?.search).toBe("?foo=bar");+ expect(location?.hash).toBe("");+ });+ });+});diff --git a/frontend/src/metabase/router/route.tsx b/frontend/src/metabase/router/route.tsxnew file mode 100644index 00000000000..35e5391456f--- /dev/null+++ b/frontend/src/metabase/router/route.tsx@@ -0,0 +1,64 @@+import { type ComponentClass, type ReactElement, createElement } from "react";++import {+ type PlainRoute,+ ReactRouterRoute,+ type RouteProps,+ createRoutes,+} from "./react-router";++/**+ * Props accepted by the `<Route>` element. Adds react-router v7's `index` on top+ * of v3's route props, so an index route is written `<Route index component={X}/>`+ * instead of the v3 `<IndexRoute>`.+ */+export type RouteElementProps = RouteProps & { index?: boolean };++interface RouteConfigElement {+ (props: RouteElementProps): null;+ createRouteFromReactElement(+ element: ReactElement<RouteElementProps>,+ parentRoute?: PlainRoute,+ ): PlainRoute | undefined;+}++/**+ * The route object type, preserved for the call sites that annotate v3's injected+ * `route` prop with `Route`.+ */+export type Route = ComponentClass<RouteProps>;++/**+ * react-router v7's `<Route>` shape running on the v3 engine. Like v3's `Route` it+ * is route configuration and never renders. It adds support for the v7 `index`+ * prop by registering the element as its parent's index route (what v3's+ * `<IndexRoute>` did); every other prop behaves exactly as v3's `<Route>`.+ *+ * @see https://reactrouter.com/7.18.1/api/components/Route+ */+export const Route: RouteConfigElement = Object.assign(+ function Route(_props: RouteElementProps): null {+ throw new Error(+ "<Route> configures the route tree and is never rendered directly",+ );+ },+ {+ createRouteFromReactElement(+ element: ReactElement<RouteElementProps>,+ parentRoute?: PlainRoute,+ ): PlainRoute | undefined {+ // Rebuild the element as a raw v3 `<Route>` so v3's own builder turns it (and+ // its children) into a route object without dispatching back into this static.+ const { index, ...props } = element.props;+ const [route] = createRoutes(createElement(ReactRouterRoute, props));++ if (index) {+ if (parentRoute && route) {+ parentRoute.indexRoute = route;+ }+ return undefined;+ }+ return route;+ },+ },+);diff --git a/frontend/src/metabase/router/route.unit.spec.tsx b/frontend/src/metabase/router/route.unit.spec.tsxnew file mode 100644index 00000000000..0b4a05e8236--- /dev/null+++ b/frontend/src/metabase/router/route.unit.spec.tsx@@ -0,0 +1,44 @@+import type { PropsWithChildren } from "react";++import { renderWithProviders, screen } from "__support__/ui";++import { Route } from "./route";++const Parent = ({ children }: PropsWithChildren) => <div>{children}</div>;+const IndexPage = () => <div>index-page</div>;+const ChildPage = () => <div>child-page</div>;++function setup(initialRoute: string) {+ return renderWithProviders(+ <Route path="parent" component={Parent}>+ <Route index component={IndexPage} />+ <Route path="child" component={ChildPage} />+ </Route>,+ { withRouter: true, initialRoute },+ );+}++describe("router/Route", () => {+ it("renders an `index` route at the parent's exact path", async () => {+ setup("/parent");++ expect(await screen.findByText("index-page")).toBeInTheDocument();+ expect(screen.queryByText("child-page")).not.toBeInTheDocument();+ });++ it("does not render the `index` route for a child path", async () => {+ setup("/parent/child");++ expect(await screen.findByText("child-page")).toBeInTheDocument();+ expect(screen.queryByText("index-page")).not.toBeInTheDocument();+ });++ it("renders a plain (non-index) route like v3", async () => {+ renderWithProviders(<Route path="solo" component={ChildPage} />, {+ withRouter: true,+ initialRoute: "/solo",+ });++ expect(await screen.findByText("child-page")).toBeInTheDocument();+ });+});diff --git a/frontend/src/metabase/router/use-location.unit.spec.tsx b/frontend/src/metabase/router/use-location.unit.spec.tsxindex 6aa3041f26d..4bbaf48b71e 100644--- a/frontend/src/metabase/router/use-location.unit.spec.tsx+++ b/frontend/src/metabase/router/use-location.unit.spec.tsx@@ -1,6 +1,6 @@import { renderWithProviders, screen } from "__support__/ui";-import { Route } from "./react-router";+import { Route } from "./route";import { useLocation } from "./use-location";function LocationProbe() {diff --git a/frontend/src/metabase/router/use-navigate.unit.spec.tsx b/frontend/src/metabase/router/use-navigate.unit.spec.tsxindex d207415654f..e580ee50cb1 100644--- a/frontend/src/metabase/router/use-navigate.unit.spec.tsx+++ b/frontend/src/metabase/router/use-navigate.unit.spec.tsx@@ -3,7 +3,7 @@ import { useState } from "react";import { renderWithProviders, screen } from "__support__/ui";-import { Route } from "./react-router";+import { Route } from "./route";import { useNavigate } from "./use-navigate";function NavigateProbe() {diff --git a/frontend/src/metabase/router/use-params.unit.spec.tsx b/frontend/src/metabase/router/use-params.unit.spec.tsxindex 5f2b9187cc5..9591ef84189 100644--- a/frontend/src/metabase/router/use-params.unit.spec.tsx+++ b/frontend/src/metabase/router/use-params.unit.spec.tsx@@ -1,6 +1,6 @@import { renderWithProviders, screen } from "__support__/ui";-import { Route } from "./react-router";+import { Route } from "./route";import { useParams } from "./use-params";function ParamsProbe() {diff --git a/frontend/src/metabase/router/use-search-params.unit.spec.tsx b/frontend/src/metabase/router/use-search-params.unit.spec.tsxindex b5eadc8f63a..194126a3fc7 100644--- a/frontend/src/metabase/router/use-search-params.unit.spec.tsx+++ b/frontend/src/metabase/router/use-search-params.unit.spec.tsx@@ -2,7 +2,7 @@ import userEvent from "@testing-library/user-event";import { act, renderWithProviders, screen } from "__support__/ui";-import { Route } from "./react-router";+import { Route } from "./route";import { useSearchParams } from "./use-search-params";function SearchParamsProbe() {diff --git a/frontend/src/metabase/routes-stable-id-aware.tsx b/frontend/src/metabase/routes-stable-id-aware.tsxindex 67897cb8b4e..f617d926466 100644--- a/frontend/src/metabase/routes-stable-id-aware.tsx+++ b/frontend/src/metabase/routes-stable-id-aware.tsx@@ -3,7 +3,12 @@ import { match } from "ts-pattern";import { NotFound } from "metabase/common/components/ErrorPages";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";-import type { WithRouterProps } from "metabase/router";+import {+ useLocation,+ useNavigate,+ useParams,+ useSearchParams,+} from "metabase/router";import { isBaseEntityID } from "metabase-types/api/entity-id";import {@@ -20,22 +25,23 @@ type ParamConfig = {};type ParamWithValue = {- value: string;+ value: string | undefined;name: string;type: ParamType;resourceType: ResourceType;};-export type EntityIdRedirectProps = WithRouterProps & {+export type EntityIdRedirectProps = {parametersToTranslate: ParamConfig[];};export const EntityIdRedirect = ({parametersToTranslate = [],- router,- params,- location,}: EntityIdRedirectProps) => {+ const navigate = useNavigate();+ const params = useParams();+ const location = useLocation();+ const [searchParams] = useSearchParams();const currentUrl = location.pathname + location.search;const paramsWithValues: ParamWithValue[] = useMemo(() => {@@ -43,14 +49,14 @@ export const EntityIdRedirect = ({return parametersToTranslate.map((config) => {const value = match(config.type).with("param", () => params[config.name])- .with("search", () => location.query[config.name])+ .with("search", () => searchParams.get(config.name) ?? undefined).exhaustive();return {...config,value,};});- }, [parametersToTranslate, params, location.query]);+ }, [parametersToTranslate, params, searchParams]);const entityIdsToTranslate = useMemo(() => {// formats the entity ids in the format {resourceType: [entityId1, entityId2]}@@ -88,10 +94,10 @@ export const EntityIdRedirect = ({}if (shouldRedirect) {- router.push(url.replace("/entity/", "/"));+ navigate(url.replace("/entity/", "/"));}}- }, [currentUrl, entity_ids, isError, isLoading, paramsWithValues, router]);+ }, [currentUrl, entity_ids, isError, isLoading, paramsWithValues, navigate]);if (isError) {throw error;@@ -137,11 +143,8 @@ function handleResults({export function createEntityIdRedirect(config: {parametersToTranslate: ParamConfig[];}) {- const Component = (props: WithRouterProps) => (- <EntityIdRedirect- {...props}- parametersToTranslate={config.parametersToTranslate}- />+ const Component = () => (+ <EntityIdRedirect parametersToTranslate={config.parametersToTranslate} />);return Component;diff --git a/frontend/src/metabase/routes.tsx b/frontend/src/metabase/routes.tsxindex a2c5cc831f5..5cb4b45debf 100644--- a/frontend/src/metabase/routes.tsx+++ b/frontend/src/metabase/routes.tsx@@ -65,7 +65,7 @@ import SegmentFieldListContainer from "metabase/reference/segments/SegmentFieldLimport SegmentListContainer from "metabase/reference/segments/SegmentListContainer";import SegmentQuestionsContainer from "metabase/reference/segments/SegmentQuestionsContainer";import SegmentRevisionsContainer from "metabase/reference/segments/SegmentRevisionsContainer";-import { IndexRedirect, IndexRoute, Redirect, Route } from "metabase/router";+import { Route, redirect } from "metabase/router";import {CanAccessDataModel,CanAccessDataStudio,@@ -100,13 +100,13 @@ export const getRoutes = (store: AppStore) => {</Route>{/* For compatibility: use the standard setup for embedding */}- <Redirect from="/setup/embedding" to="/setup" />+ <Route path="/setup/embedding" component={redirect("/setup")} />{/* APP */}<Route component={LoadCurrentUser}>{/* AUTH */}<Route path="/auth">- <IndexRedirect to="/auth/login" />+ <Route index component={redirect("/auth/login")} /><Route component={IsNotAuthenticated}><Route path="login" component={Login} /><Route path="login/:provider" component={Login} />@@ -128,12 +128,12 @@ export const getRoutes = (store: AppStore) => {<Route path="/" component={LandingPageRedirect} /><Route path="getting-started" component={CanAccessOnboarding}>- <IndexRoute component={Onboarding} />+ <Route index component={Onboarding} /></Route><Route path="search" component={SearchApp} />{/* Send historical /archive route to trash - can remove in v52 */}- <Redirect from="archive" to="trash" />+ <Route path="archive" component={redirect("trash")} /><Route path="trash" component={TrashCollectionLanding} /><Route path="document/:entityId" component={DocumentPageOuter}>@@ -156,18 +156,18 @@ export const getRoutes = (store: AppStore) => {/><Route path="collection/users" component={IsAdmin}>- <IndexRoute component={UserCollectionList} />+ <Route index component={UserCollectionList} /></Route><Routepath="collection/tenant-specific"component={PLUGIN_TENANTS.CanAccessTenantSpecificRoute}>- <IndexRoute component={PLUGIN_TENANTS.TenantCollectionList} />+ <Route index component={PLUGIN_TENANTS.TenantCollectionList} /></Route><Route path="collection/tenant-users" component={IsAdmin}>- <IndexRoute component={PLUGIN_TENANTS.TenantUsersList} />+ <Route index component={PLUGIN_TENANTS.TenantUsersList} /><Routepath=":tenantId"component={PLUGIN_TENANTS.TenantUsersPersonalCollectionList}@@ -225,7 +225,7 @@ export const getRoutes = (store: AppStore) => {],})}/>- <IndexRoute component={QueryBuilder} />+ <Route index component={QueryBuilder} /><Route path="notebook" component={QueryBuilder} /><Route path="ask" component={MetabotQueryBuilder} /><Route path=":slug" component={QueryBuilder} />@@ -238,7 +238,7 @@ export const getRoutes = (store: AppStore) => {{getModelRoutes()}<Route path="/model">- <IndexRoute component={QueryBuilder} />+ <Route index component={QueryBuilder} /><Route path="new" component={NewModelOptions} /><Route path=":slug" component={QueryBuilder} /><Route path=":slug/notebook" component={QueryBuilder} />@@ -254,7 +254,7 @@ export const getRoutes = (store: AppStore) => {{getMetricRoutes()}<Route path="browse">- <IndexRedirect to="/browse/models" />+ <Route index component={redirect("/browse/models")} /><Route path="metrics" component={BrowseMetrics} /><Route path="models" component={BrowseModels} /><Route path="databases" component={BrowseDatabases} />@@ -267,10 +267,13 @@ export const getRoutes = (store: AppStore) => {{PLUGIN_TABLE_EDITING.getRoutes()}{/* These two Redirects support legacy paths in v48 and earlier */}- <Redirect from=":dbId-:slug" to="databases/:dbId-:slug" />- <Redirect- from=":dbId/schema/:schemaName"- to="databases/:dbId/schema/:schemaName"+ <Route+ path=":dbId-:slug"+ component={redirect("databases/:dbId-:slug")}+ />+ <Route+ path=":dbId/schema/:schemaName"+ component={redirect("databases/:dbId/schema/:schemaName")}/></Route>@@ -287,7 +290,7 @@ export const getRoutes = (store: AppStore) => {{/* REFERENCE */}<Route path="/reference">- <IndexRedirect to="/reference/databases" />+ <Route index component={redirect("/reference/databases")} /><Route path="segments" component={SegmentListContainer} /><Routepath="segments/:segmentId"@@ -356,15 +359,24 @@ export const getRoutes = (store: AppStore) => {{/* NOTE: these custom routes are needed because <Redirect> doesn't preserve the hash */}<Route path="/q" component={QuestionHashRedirect} /><Route path="/card/:slug" component={QuestionHashRedirect} />- <Redirect from="/dash/:dashboardId" to="/dashboard/:dashboardId" />- <Redirect- from="/collections/permissions"- to="/admin/permissions/collections"+ <Route+ path="/dash/:dashboardId"+ component={redirect("/dashboard/:dashboardId")}+ />+ <Route+ path="/collections/permissions"+ component={redirect("/admin/permissions/collections")}/>{/* Transforms moved from /admin to /data-studio */}- <Redirect from="/admin/transforms" to="/data-studio/transforms" />- <Redirect from="/admin/transforms/*" to="/data-studio/transforms/*" />+ <Route+ path="/admin/transforms"+ component={redirect("/data-studio/transforms")}+ />+ <Route+ path="/admin/transforms/*"+ component={redirect("/data-studio/transforms/*")}+ />{/* MISC */}<Route path="/unsubscribe" component={UnsubscribePage} />diff --git a/frontend/src/metabase/transforms/routes.tsx b/frontend/src/metabase/transforms/routes.tsxindex 138983e65eb..cbdac159347 100644--- a/frontend/src/metabase/transforms/routes.tsx+++ b/frontend/src/metabase/transforms/routes.tsx@@ -3,7 +3,7 @@ import {PLUGIN_REPLACEMENT,PLUGIN_TRANSFORMS_PYTHON,} from "metabase/plugins";-import { IndexRoute, Route } from "metabase/router";+import { Route } from "metabase/router";import { JobListPage } from "./pages/JobListPage";import { JobPage } from "./pages/JobPage";@@ -27,10 +27,10 @@ import { TransformsNotDisabled } from "./route-guards";export function getDataStudioTransformRoutes() {return (<Route component={TransformsNotDisabled}>- <IndexRoute component={TransformListPage} />+ <Route index component={TransformListPage} /><Route path="runs" component={RunListPage} /><Route path="jobs" component={JobSectionLayout}>- <IndexRoute component={JobListPage} />+ <Route index component={JobListPage} /><Route path="new" component={NewJobPage} /><Route path=":jobId" component={JobPage} /><Route path=":jobId/runs" component={JobRunListPage} />@@ -50,7 +50,7 @@ export function getDataStudioTransformRoutes() {path=":transformId/dependencies"component={TransformDependenciesPage}>- <IndexRoute component={PLUGIN_DEPENDENCIES.DependencyGraphPage} />+ <Route index component={PLUGIN_DEPENDENCIES.DependencyGraphPage} /></Route>)}{PLUGIN_TRANSFORMS_PYTHON.getPythonTransformsRoutes()}