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
Re-home history@3 types onto the metabase/router facade (#78190)
Romeo Van Snick3ee16f6e791c
diff --git a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsxindex 5161dafd7df..ae057ec8375 100644--- a/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx+++ b/enterprise/frontend/src/metabase-enterprise/clean_up/CleanupCollectionModal/CleanupCollectionModal.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { useEffect, useMemo, useState } from "react";import { t } from "ttag";@@ -7,6 +6,7 @@ import { DelayedLoadingAndErrorWrapper } from "metabase/common/components/Loadinimport { PaginationControls } from "metabase/common/components/PaginationControls";import { useUserSetting } from "metabase/common/hooks";import { useListSelect } from "metabase/common/hooks/use-list-select";+import type { Location } from "metabase/router";import { Flex, Modal } from "metabase/ui";import * as Urls from "metabase/urls";import { useListStaleCollectionItemsQuery } from "metabase-enterprise/api/collection";diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/pages/NewMetricPage/NewMetricPage.tsx b/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/pages/NewMetricPage/NewMetricPage.tsxindex a42971fd253..11c2365cdf8 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/pages/NewMetricPage/NewMetricPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/library/metrics/pages/NewMetricPage/NewMetricPage.tsx@@ -1,9 +1,8 @@-import type { Location } from "history";import { t } from "ttag";import { DataStudioBreadcrumbs } from "metabase/common/data-studio/components/DataStudioBreadcrumbs";import { NewMetricPage } from "metabase/metrics/pages/NewMetricPage";-import { Link, type Route } from "metabase/router";+import { Link, type Location, type Route } from "metabase/router";import * as Urls from "metabase/urls";import { dataStudioMetricUrls } from "../../urls";diff --git a/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/components/TableHeader/TableTabs/TableTabs.tsx b/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/components/TableHeader/TableTabs/TableTabs.tsxindex 2a47b0458a1..811c131c720 100644--- a/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/components/TableHeader/TableTabs/TableTabs.tsx+++ b/enterprise/frontend/src/metabase-enterprise/data-studio/library/tables/components/TableHeader/TableTabs/TableTabs.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { t } from "ttag";import {@@ -7,6 +6,7 @@ import {} from "metabase/common/data-studio/components/PaneHeader";import { PLUGIN_DEPENDENCIES } from "metabase/plugins";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getLocation } from "metabase/selectors/routing";import * as Urls from "metabase/urls";import type { Table } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyGraphPage/DependencyGraphPage.tsx b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyGraphPage/DependencyGraphPage.tsxindex dbc829f22b2..aff24946778 100644--- a/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyGraphPage/DependencyGraphPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/dependencies/pages/DependencyGraphPage/DependencyGraphPage.tsx@@ -1,9 +1,9 @@-import type { Location } from "history";import { useContext } from "react";import { skipToken } from "metabase/api";import { AppSwitcher } from "metabase/nav/components/AppSwitcher";import { PLUGIN_DEPENDENCIES } from "metabase/plugins";+import type { Location } from "metabase/router";import { Stack } from "metabase/ui";import * as Urls from "metabase/urls";import { useGetDependencyGraphQuery } from "metabase-enterprise/api";diff --git a/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/DependencyDiagnosticsPage.tsx b/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/DependencyDiagnosticsPage.tsxindex f6f6d61b6b0..8eca7af9d7e 100644--- a/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/DependencyDiagnosticsPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/DependencyDiagnosticsPage.tsx@@ -1,8 +1,8 @@-import type { Location } from "history";import { useEffect, useMemo, useRef } from "react";import { useUserKeyValue } from "metabase/common/hooks/use-user-key-value";import { useDispatch } from "metabase/redux";+import type { Location } from "metabase/router";import { replace } from "metabase/router";import type * as Urls from "metabase/urls";import { DependencyDiagnostics } from "metabase-enterprise/monitor/dependency-diagnostics/components";diff --git a/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/utils.ts b/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/utils.tsindex 4e7dd851c28..fc2e7933e4f 100644--- a/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/utils.ts+++ b/enterprise/frontend/src/metabase-enterprise/monitor/dependency-diagnostics/pages/utils.ts@@ -1,5 +1,4 @@-import type { Location } from "history";-+import type { Location } from "metabase/router";import * as Urls from "metabase/urls";import type { DependencyDiagnosticsMode } from "metabase-enterprise/monitor/dependency-diagnostics/components/types";import {diff --git a/enterprise/frontend/src/metabase-enterprise/schema_viewer/pages/SchemaViewerPage/SchemaViewerPage.tsx b/enterprise/frontend/src/metabase-enterprise/schema_viewer/pages/SchemaViewerPage/SchemaViewerPage.tsxindex 4eabbc2e6b5..d784e348913 100644--- a/enterprise/frontend/src/metabase-enterprise/schema_viewer/pages/SchemaViewerPage/SchemaViewerPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/schema_viewer/pages/SchemaViewerPage/SchemaViewerPage.tsx@@ -1,9 +1,9 @@-import type { Location } from "history";import { useMemo } from "react";import { t } from "ttag";import { skipToken } from "metabase/api";import { usePageTitle } from "metabase/hooks/use-page-title";+import type { Location } from "metabase/router";import { Stack } from "metabase/ui";import { getSchemaViewerParams } from "metabase/urls";import { useGetErdQuery } from "metabase-enterprise/api";diff --git a/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.tsx b/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.tsxindex 3ee1598cc87..9e71bf4cdbe 100644--- a/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { useCallback, useEffect, useRef, useState } from "react";import { t } from "ttag";@@ -7,6 +6,7 @@ import { useSyncSecurityAdvisoriesMutation } from "metabase/api";import { EmptyState } from "metabase/common/components/EmptyState";import { useSetting, useToast } from "metabase/common/hooks";import { useIsSmallScreen } from "metabase/common/hooks/use-is-small-screen";+import type { Location } from "metabase/router";import {Box,Button,diff --git a/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.unit.spec.tsxindex dbf6c9bae6c..9568e393bb9 100644--- a/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.unit.spec.tsx+++ b/enterprise/frontend/src/metabase-enterprise/security_center/components/SecurityCenterPage/SecurityCenterPage.unit.spec.tsx@@ -1,10 +1,10 @@import userEvent from "@testing-library/user-event";import fetchMock from "fetch-mock";-import type { Location } from "history";import { setupRecentViewsAndSelectionsEndpoints } from "__support__/server-mocks";import { renderWithProviders, screen, within } from "__support__/ui";import { createMockSettingsState } from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import type { Advisory } from "metabase-types/api";import { createMockVersion } from "metabase-types/api/mocks";import { createAdvisory } from "metabase-types/api/mocks/security-center";diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/EditTableDataContainer.tsx b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/EditTableDataContainer.tsxindex 1ab85ec1f37..6115f16545b 100644--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/EditTableDataContainer.tsx+++ b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/EditTableDataContainer.tsx@@ -1,5 +1,4 @@import { useDisclosure } from "@mantine/hooks";-import type { Location } from "history";import { useCallback, useMemo } from "react";import { msgid, ngettext, t } from "ttag";@@ -11,6 +10,7 @@ import {import { GenericError } from "metabase/common/components/ErrorPages";import { useCloseNavbarOnMount } from "metabase/common/hooks/use-close-navbar-on-mount";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getUserIsAdmin } from "metabase/selectors/user";import { Box, Flex, Stack, Text } from "metabase/ui";import { extractRemappedColumns } from "metabase/visualizations";diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-adhoc-table-query.ts b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-adhoc-table-query.tsindex 979f18b00c0..f65a4641fbe 100644--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-adhoc-table-query.ts+++ b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-adhoc-table-query.ts@@ -1,8 +1,8 @@-import type { Location } from "history";import { useCallback, useEffect, useMemo } from "react";import { loadMetadataForTable } from "metabase/questions/actions";import { useDispatch, useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { push } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import { b64url_to_utf8, utf8_to_b64url } from "metabase/utils/encoding";diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-edit-table-data.ts b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-edit-table-data.tsindex 511ad377fac..81b78f29476 100644--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-edit-table-data.ts+++ b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/use-edit-table-data.ts@@ -1,7 +1,7 @@-import type { Location } from "history";import { useCallback } from "react";import { skipToken, useGetAdhocQueryQuery } from "metabase/api";+import type { Location } from "metabase/router";import * as Lib from "metabase-lib";import type Question from "metabase-lib/v1/Question";import type { DatasetColumn } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/containers/NewTenantModal/NewTenantModal.tsx b/enterprise/frontend/src/metabase-enterprise/tenants/containers/NewTenantModal/NewTenantModal.tsxindex 0c818e312a0..12caf0ef49f 100644--- a/enterprise/frontend/src/metabase-enterprise/tenants/containers/NewTenantModal/NewTenantModal.tsx+++ b/enterprise/frontend/src/metabase-enterprise/tenants/containers/NewTenantModal/NewTenantModal.tsx@@ -1,9 +1,9 @@-import type { Location } from "history";import { useMemo } from "react";import { t } from "ttag";import { useDispatch } from "metabase/redux";import { addUndo } from "metabase/redux/undo";+import type { Location } from "metabase/router";import { Modal } from "metabase/ui";import { useCreateTenantMutation } from "metabase-enterprise/api";import type { Tenant } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/TransformInspectPage.tsx b/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/TransformInspectPage.tsxindex bccffab2f20..64da2c313a3 100644--- a/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/TransformInspectPage.tsx+++ b/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/TransformInspectPage.tsx@@ -1,9 +1,9 @@-import type { Location } from "history";import { match } from "ts-pattern";import { t } from "ttag";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { PageContainer } from "metabase/common/data-studio/components/PageContainer";+import type { Location } from "metabase/router";import { TransformDisconnectedDatabaseBanner } from "metabase/transforms/components/TransformDisconnectedDatabaseBanner";import { TransformHeader } from "metabase/transforms/components/TransformHeader";import { useTransformPermissions } from "metabase/transforms/hooks/use-transform-permissions";diff --git a/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/InspectorContent.tsx b/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/InspectorContent.tsxindex a1345a42314..7aff8ae9dce 100644--- a/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/InspectorContent.tsx+++ b/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/InspectorContent.tsx@@ -1,8 +1,8 @@-import type { Location } from "history";import { useCallback } from "react";import { useGetInspectorDiscoveryQuery } from "metabase/api";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";+import type { Location } from "metabase/router";import { trackTransformInspectDrillLensClosed } from "metabase/transforms/analytics";import { Center } from "metabase/ui";import type { Transform } from "metabase-types/api";diff --git a/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/LensNavigator/useLensNavigation.ts b/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/LensNavigator/useLensNavigation.tsindex 548679957e3..66986b7d9e4 100644--- a/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/LensNavigator/useLensNavigation.ts+++ b/enterprise/frontend/src/metabase-enterprise/transforms-inspector/pages/TransformInspectPage/components/LensNavigator/useLensNavigation.ts@@ -1,8 +1,8 @@-import type { Location } from "history";import { useCallback, useEffect, useMemo, useState } from "react";import { t } from "ttag";import { useDispatch } from "metabase/redux";+import type { Location } from "metabase/router";import { push, replace } from "metabase/router";import type { InspectorLensMetadata } from "metabase-types/api";diff --git a/frontend/src/metabase/AppComponent.tsx b/frontend/src/metabase/AppComponent.tsxindex 36245e48e07..b97475d07be 100644--- a/frontend/src/metabase/AppComponent.tsx+++ b/frontend/src/metabase/AppComponent.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { useEffect, useState } from "react";import { AppBarContainer } from "metabase/app/nav/AppBar";@@ -26,6 +25,7 @@ import { usePageTitle } from "metabase/hooks/use-page-title";import { connect, useSelector } from "metabase/redux";import { setErrorPage } from "metabase/redux/app";import type { AppErrorDescriptor, State } from "metabase/redux/store";+import type { Location } from "metabase/router";import { Outlet, useLocation } from "metabase/router";import { getErrorPage } from "metabase/selectors/app";import { getApplicationName } from "metabase/selectors/whitelabel";diff --git a/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx b/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsxindex 18afd68ee9b..0f313e9e2f7 100644--- a/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx+++ b/frontend/src/metabase/account/app/components/AccountHeader/AccountHeader.tsx@@ -1,4 +1,3 @@-import type { Path } from "history";import { useMemo } from "react";import { t } from "ttag";@@ -14,7 +13,7 @@ import S from "./AccountHeader.module.css";type AccountHeaderProps = {user: User;path?: string;- onChangeLocation?: (nextLocation: Path) => void;+ onChangeLocation?: (nextLocation: string) => void;};export const AccountHeader = ({diff --git a/frontend/src/metabase/account/app/components/AccountLayout/AccountLayout.tsx b/frontend/src/metabase/account/app/components/AccountLayout/AccountLayout.tsxindex 47cb2ff1684..d255d3d6967 100644--- a/frontend/src/metabase/account/app/components/AccountLayout/AccountLayout.tsx+++ b/frontend/src/metabase/account/app/components/AccountLayout/AccountLayout.tsx@@ -1,5 +1,3 @@-import type { Path } from "history";-import { Outlet } from "metabase/router";import { Box, rem } from "metabase/ui";import type { User } from "metabase-types/api";@@ -9,7 +7,7 @@ import { AccountHeader } from "../AccountHeader";interface AccountLayoutProps {user: User | null;path?: string;- onChangeLocation: (nextLocation: Path) => void;+ onChangeLocation: (nextLocation: string) => void;}const AccountLayout = ({diff --git a/frontend/src/metabase/account/app/containers/AccountApp/AccountApp.tsx b/frontend/src/metabase/account/app/containers/AccountApp/AccountApp.tsxindex 46c02b6e685..6b1f677b4bb 100644--- a/frontend/src/metabase/account/app/containers/AccountApp/AccountApp.tsx+++ b/frontend/src/metabase/account/app/containers/AccountApp/AccountApp.tsx@@ -1,7 +1,6 @@-import type { Location } from "history";-import { connect } from "metabase/redux";import type { State } from "metabase/redux/store";+import type { Location } from "metabase/router";import { push } from "metabase/router";import { getUser } from "metabase/selectors/user";diff --git a/frontend/src/metabase/account/notifications/containers/ArchiveAlertModal/DeleteAlertModal.tsx b/frontend/src/metabase/account/notifications/containers/ArchiveAlertModal/DeleteAlertModal.tsxindex 73661c990e1..a23dcf4ad3b 100644--- a/frontend/src/metabase/account/notifications/containers/ArchiveAlertModal/DeleteAlertModal.tsx+++ b/frontend/src/metabase/account/notifications/containers/ArchiveAlertModal/DeleteAlertModal.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { t } from "ttag";import {@@ -9,6 +8,7 @@ import {import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { useToast } from "metabase/common/hooks/use-toast";import { DeleteAlertConfirmModal } from "metabase/notifications/modals/DeleteAlertConfirmModal";+import type { Location } from "metabase/router";import type { Notification } from "metabase-types/api";import { getAlertId } from "../../selectors";diff --git a/frontend/src/metabase/account/notifications/containers/ArchivePulseModal/ArchivePulseModal.tsx b/frontend/src/metabase/account/notifications/containers/ArchivePulseModal/ArchivePulseModal.tsxindex 06791a527bf..41fc08ced2c 100644--- a/frontend/src/metabase/account/notifications/containers/ArchivePulseModal/ArchivePulseModal.tsx+++ b/frontend/src/metabase/account/notifications/containers/ArchivePulseModal/ArchivePulseModal.tsx@@ -1,5 +1,4 @@import { skipToken } from "@reduxjs/toolkit/query/react";-import type { Location } from "history";import {useGetSubscriptionQuery,@@ -7,6 +6,7 @@ import {} from "metabase/api";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getUser } from "metabase/selectors/user";import { ArchiveNotificationModal } from "../../components/ArchiveModal";diff --git a/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.tsx b/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.tsxindex 8edae8c3351..8be8da56b75 100644--- a/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.tsx+++ b/frontend/src/metabase/actions/containers/ActionCreatorModal/ActionCreatorModal.tsx@@ -1,4 +1,3 @@-import type { LocationDescriptor } from "history";import { useEffect } from "react";import { skipToken, useGetActionQuery, useGetCardQuery } from "metabase/api";@@ -7,8 +6,7 @@ import type { ModalComponentProps } from "metabase/common/components/ModalRoute"import { connect, useSelector } from "metabase/redux";import { setErrorPage } from "metabase/redux/app";import type { AppErrorDescriptor } from "metabase/redux/store";-import type { Route } from "metabase/router";-import { replace } from "metabase/router";+import { type LocationDescriptor, type Route, replace } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import * as Urls from "metabase/urls";import type Question from "metabase-lib/v1/Question";diff --git a/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.tsx b/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.tsxindex c989f8beba4..21f97bb36ae 100644--- a/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.tsx+++ b/frontend/src/metabase/admin/datamodel/containers/SegmentListApp.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import type { ReactNode } from "react";import { t } from "ttag";@@ -14,6 +13,7 @@ import AdminS from "metabase/css/admin.module.css";import CS from "metabase/css/core/index.css";import { PLUGIN_REMOTE_SYNC } from "metabase/plugins";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getShallowTables } from "metabase/selectors/metadata";import { getUserIsAdmin } from "metabase/selectors/user";import { Button } from "metabase/ui";diff --git a/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.tsx b/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.tsxindex bd569edd3d1..e6ca35ca86f 100644--- a/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.tsx+++ b/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { type ComponentType, type ReactNode, useState } from "react";import { t } from "ttag";@@ -8,6 +7,7 @@ import { FieldSet } from "metabase/common/components/FieldSet";import CS from "metabase/css/core/index.css";import { DatabaseSchemaAndTableDataSelector } from "metabase/querying/common/components/DataSelector";import { connect, useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { push } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import { Icon } from "metabase/ui";diff --git a/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsx b/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsxindex 662942dd9b9..c5049aaca5b 100644--- a/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsx+++ b/frontend/src/metabase/admin/embedding/containers/AdminEmbeddingApp.tsx@@ -1,6 +1,5 @@-import type { Location } from "history";-import { AdminSettingsLayout } from "metabase/admin/components/AdminLayout/AdminSettingsLayout";+import type { Location } from "metabase/router";import { Outlet } from "metabase/router";import { EmbeddingNav } from "../components/EmbeddingNav";diff --git a/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.unit.spec.tsx b/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.unit.spec.tsxindex 657712f4fbb..1b5121e5839 100644--- a/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.unit.spec.tsx+++ b/frontend/src/metabase/admin/performance/hooks/useConfirmOnRouteLeave.unit.spec.tsx@@ -1,6 +1,5 @@-import type { History } from "history";-import { act, renderWithProviders, screen } from "__support__/ui";+import type { History } from "metabase/router";import { Route } from "metabase/router";import { checkNotNull } from "metabase/utils/types";diff --git a/frontend/src/metabase/app/selectors.unit.spec.ts b/frontend/src/metabase/app/selectors.unit.spec.tsindex 86159f13d46..29c9c146606 100644--- a/frontend/src/metabase/app/selectors.unit.spec.ts+++ b/frontend/src/metabase/app/selectors.unit.spec.ts@@ -1,6 +1,5 @@-import type { Location } from "history";-import { createMockState } from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import type { RouterProps } from "metabase/selectors/app";import { getIsCollectionPathVisible } from "./selectors";diff --git a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsxindex e1f52cbf559..09b706d9c34 100644--- a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx+++ b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx@@ -1,9 +1,9 @@-import type { Location } from "history";import { useCallback, useState } from "react";import { t } from "ttag";import { useDispatch, useSelector } from "metabase/redux";import { forgotPassword } from "metabase/redux/auth";+import type { Location } from "metabase/router";import { Button } from "metabase/ui";import { getIsEmailConfigured, getIsLdapEnabled } from "../../selectors";diff --git a/frontend/src/metabase/auth/components/Login/Login.tsx b/frontend/src/metabase/auth/components/Login/Login.tsxindex 753cbaa290a..a566bddc8c8 100644--- a/frontend/src/metabase/auth/components/Login/Login.tsx+++ b/frontend/src/metabase/auth/components/Login/Login.tsx@@ -1,10 +1,10 @@-import type { Location } from "history";import { t } from "ttag";import _ from "underscore";import { usePageTitle } from "metabase/hooks/use-page-title";import type { AuthProvider } from "metabase/plugins/types";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getApplicationName } from "metabase/selectors/whitelabel";import { Box, Divider } from "metabase/ui";diff --git a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsxindex 71bff3e1c14..42f607ce4e8 100644--- a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx+++ b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { useCallback } from "react";import { t } from "ttag";@@ -8,6 +7,7 @@ import { useValidatePassword } from "metabase/common/hooks";import { useToast } from "metabase/common/hooks/use-toast";import { useDispatch } from "metabase/redux";import { resetPassword } from "metabase/redux/auth";+import type { Location } from "metabase/router";import { replace } from "metabase/router";import { Button } from "metabase/ui";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/common/collections/hooks.ts b/frontend/src/metabase/common/collections/hooks.tsindex 2666b7c3262..1e456d4c47b 100644--- a/frontend/src/metabase/common/collections/hooks.ts+++ b/frontend/src/metabase/common/collections/hooks.ts@@ -1,10 +1,10 @@-import type { Location } from "history";import { useMemo } from "react";import { skipToken, useGetCollectionQuery } from "metabase/api";import { ROOT_COLLECTION } from "metabase/common/collections/constants";import { PLUGIN_COLLECTIONS } from "metabase/plugins";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getUser, getUserPersonalCollectionId } from "metabase/selectors/user";import * as Urls from "metabase/urls/collections";import type { Collection, CollectionId } from "metabase-types/api";diff --git a/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx b/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsxindex 02624fd44a3..2cd502942d5 100644--- a/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx+++ b/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx@@ -1,10 +1,13 @@-import type { Location } from "history";import { useEffect } from "react";import { usePrevious } from "react-use";import { useConfirmRouteLeaveModal } from "metabase/common/hooks/use-confirm-route-leave-modal";-import type { Route } from "metabase/router";-import { useRoute, useRouter } from "metabase/router";+import {+ type Location,+ type Route,+ useRoute,+ useRouter,+} from "metabase/router";import { LeaveConfirmModal } from "./LeaveConfirmModal";diff --git a/frontend/src/metabase/common/components/ModalRoute.tsx b/frontend/src/metabase/common/components/ModalRoute.tsxindex fb9eb2fc711..ef6f0e18ca3 100644--- a/frontend/src/metabase/common/components/ModalRoute.tsx+++ b/frontend/src/metabase/common/components/ModalRoute.tsx@@ -1,6 +1,6 @@-import type { Location } from "history";import { useCallback } from "react";+import type { Location } from "metabase/router";import {Route,useNavigate,diff --git a/frontend/src/metabase/common/components/NotFoundFallbackPage.tsx b/frontend/src/metabase/common/components/NotFoundFallbackPage.tsxindex c1accb70c21..12b0888824f 100644--- a/frontend/src/metabase/common/components/NotFoundFallbackPage.tsx+++ b/frontend/src/metabase/common/components/NotFoundFallbackPage.tsx@@ -1,9 +1,9 @@-import type { LocationDescriptor } from "history";import { useMount } from "react-use";import { NotFound } from "metabase/common/components/ErrorPages";import { connect } from "metabase/redux";import { refreshCurrentUser } from "metabase/redux/user";+import type { LocationDescriptor } from "metabase/router";import { replace } from "metabase/router";type DispatchProps = {diff --git a/frontend/src/metabase/common/components/SearchResult/SearchResult.tsx b/frontend/src/metabase/common/components/SearchResult/SearchResult.tsxindex a8e75247043..bc16251892b 100644--- a/frontend/src/metabase/common/components/SearchResult/SearchResult.tsx+++ b/frontend/src/metabase/common/components/SearchResult/SearchResult.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { LocationDescriptorObject } from "history";import type { AnchorHTMLAttributes, HTMLAttributes, MouseEvent } from "react";import { forwardRef, useCallback } from "react";@@ -7,6 +6,7 @@ import { Markdown } from "metabase/common/components/Markdown";import { trackSearchClick } from "metabase/common/search/analytics";import { PLUGIN_MODERATION } from "metabase/plugins";import { useDispatch } from "metabase/redux";+import type { LocationDescriptorObject } from "metabase/router";import { push } from "metabase/router";import type { AnchorProps, BoxProps, StackProps } from "metabase/ui";import {diff --git a/frontend/src/metabase/common/components/Unsubscribe.tsx b/frontend/src/metabase/common/components/Unsubscribe.tsxindex cbd5ef62680..e3b887f0263 100644--- a/frontend/src/metabase/common/components/Unsubscribe.tsx+++ b/frontend/src/metabase/common/components/Unsubscribe.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { useMemo, useState } from "react";import { useAsync } from "react-use";import { jt, t } from "ttag";@@ -15,6 +14,7 @@ import { LighthouseIllustration } from "metabase/common/components/LighthouseIllimport { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { LogoIcon } from "metabase/common/components/LogoIcon";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getLoginPageIllustration } from "metabase/selectors/whitelabel";import { Button, Center, Stack, Text } from "metabase/ui";diff --git a/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts b/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.tsindex 93e9361fd0a..012d96298a5 100644--- a/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts+++ b/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts@@ -1,10 +1,16 @@-import type { Location } from "history";import { useCallback, useEffect, useState } from "react";import { match } from "ts-pattern";import { useDispatch } from "metabase/redux";-import type { InjectedRouter, PlainRoute, Route } from "metabase/router";-import { goBack, push, replace } from "metabase/router";+import {+ type InjectedRouter,+ type Location,+ type PlainRoute,+ type Route,+ goBack,+ push,+ replace,+} from "metabase/router";import { useBeforeUnload } from "./use-before-unload";diff --git a/frontend/src/metabase/common/hooks/use-url-state/types.ts b/frontend/src/metabase/common/hooks/use-url-state/types.tsindex b0396f6116e..d531f343a16 100644--- a/frontend/src/metabase/common/hooks/use-url-state/types.ts+++ b/frontend/src/metabase/common/hooks/use-url-state/types.ts@@ -1,3 +1,3 @@-import type { Query } from "history";+import type { Query } from "metabase/router";export type QueryParam = Query[keyof Query];diff --git a/frontend/src/metabase/common/hooks/use-url-state/use-url-state.ts b/frontend/src/metabase/common/hooks/use-url-state/use-url-state.tsindex 11e6da950a3..b5ab3ec7589 100644--- a/frontend/src/metabase/common/hooks/use-url-state/use-url-state.ts+++ b/frontend/src/metabase/common/hooks/use-url-state/use-url-state.ts@@ -1,9 +1,9 @@-import type { Location, Query } from "history";import { useCallback, useEffect, useState } from "react";import { useEffectOnce, useLatest } from "react-use";import { useDebouncedValue } from "metabase/common/hooks/use-debounced-value";import { useDispatch } from "metabase/redux";+import type { Location, Query } from "metabase/router";import { push, replace } from "metabase/router";type BaseState = Record<string, unknown>;diff --git a/frontend/src/metabase/common/hooks/use-url-state/use-url-state.unit.spec.ts b/frontend/src/metabase/common/hooks/use-url-state/use-url-state.unit.spec.tsindex c3f48bb9141..b0b77ae3956 100644--- a/frontend/src/metabase/common/hooks/use-url-state/use-url-state.unit.spec.ts+++ b/frontend/src/metabase/common/hooks/use-url-state/use-url-state.unit.spec.ts@@ -1,7 +1,6 @@-import type { Location } from "history";-import { act, renderHookWithProviders, waitFor } from "__support__/ui";import { createMockLocation } from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import type { QueryParam } from "./types";import { type UrlStateConfig, useUrlState } from "./use-url-state";diff --git a/frontend/src/metabase/common/search/types.ts b/frontend/src/metabase/common/search/types.tsindex 94384ad15ed..3481f16155a 100644--- a/frontend/src/metabase/common/search/types.ts+++ b/frontend/src/metabase/common/search/types.ts@@ -1,7 +1,7 @@-import type { Location } from "history";import type { ComponentType } from "react";import type { SearchFilterKeys } from "metabase/common/search/constants";+import type { Location } from "metabase/router";import type { EnabledSearchModel, IconName, UserId } from "metabase-types/api";export type TypeFilterProps = EnabledSearchModel[];diff --git a/frontend/src/metabase/dashboard/actions/parameters.tsx b/frontend/src/metabase/dashboard/actions/parameters.tsxindex 65b58cef850..ff851abb3b8 100644--- a/frontend/src/metabase/dashboard/actions/parameters.tsx+++ b/frontend/src/metabase/dashboard/actions/parameters.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { LocationDescriptorObject } from "history";import { assoc } from "icepick";import { t } from "ttag";import _ from "underscore";@@ -25,6 +24,7 @@ import { createAction, createThunkAction } from "metabase/redux";import { selectTab, setParameterValues } from "metabase/redux/dashboard";import type { Dispatch, GetState } from "metabase/redux/store";import { addUndo, dismissUndo } from "metabase/redux/undo";+import type { LocationDescriptorObject } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import { Text } from "metabase/ui";import { isQuestionDashCard } from "metabase/utils/dashboard";diff --git a/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx b/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsxindex 01efbac3cba..a33bff92135 100644--- a/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx+++ b/frontend/src/metabase/dashboard/components/DashCard/DashCardVisualization.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { LocationDescriptorObject } from "history";import { useCallback, useMemo } from "react";import { t } from "ttag";import _ from "underscore";@@ -20,6 +19,7 @@ import {import { EmbeddingEntityContextProvider } from "metabase/embedding/context";import { PLUGIN_CONTENT_TRANSLATION } from "metabase/plugins";import { useDispatch, useSelector } from "metabase/redux";+import type { LocationDescriptorObject } from "metabase/router";import { push } from "metabase/router";import { getSetting } from "metabase/selectors/settings";import { Flex, Group, type IconProps, Menu, Title } from "metabase/ui";diff --git a/frontend/src/metabase/dashboard/components/DashboardLeaveConfirmationModal/utils.ts b/frontend/src/metabase/dashboard/components/DashboardLeaveConfirmationModal/utils.tsindex 49bea96c5b2..fbcd180ee02 100644--- a/frontend/src/metabase/dashboard/components/DashboardLeaveConfirmationModal/utils.ts+++ b/frontend/src/metabase/dashboard/components/DashboardLeaveConfirmationModal/utils.ts@@ -1,6 +1,5 @@-import type { Location } from "history";-import { deserializeCard, parseHash } from "metabase/common/utils/card";+import type { Location } from "metabase/router";export const isNavigatingToCreateADashboardQuestion = (nextLocation?: Location,diff --git a/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsxindex 907c00ef865..239947c715b 100644--- a/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsx@@ -1,5 +1,4 @@import userEvent from "@testing-library/user-event";-import type { Location } from "history";import { renderWithProviders, screen, within } from "__support__/ui";import { INPUT_WRAPPER_TEST_ID } from "metabase/common/components/TabButton";@@ -13,6 +12,7 @@ import type { DashboardState } from "metabase/redux/store";import {type InjectedRouter,Link,+ type Location,Route,type WithRouterProps,withRouteProps,diff --git a/frontend/src/metabase/dashboard/containers/DashboardApp/DashboardApp.tsx b/frontend/src/metabase/dashboard/containers/DashboardApp/DashboardApp.tsxindex 71f7f6550db..10c5ded13b3 100644--- a/frontend/src/metabase/dashboard/containers/DashboardApp/DashboardApp.tsx+++ b/frontend/src/metabase/dashboard/containers/DashboardApp/DashboardApp.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { useState } from "react";import ErrorBoundary from "metabase/ErrorBoundary";@@ -32,6 +31,7 @@ import {} from "metabase/hooks/use-page-title";import { useDispatch, useSelector } from "metabase/redux";import { setErrorPage } from "metabase/redux/app";+import type { Location } from "metabase/router";import { Outlet, replace, useRouter } from "metabase/router";import * as Urls from "metabase/urls";import { parseHashOptions, stringifyHashOptions } from "metabase/utils/browser";diff --git a/frontend/src/metabase/dashboard/hooks/use-auto-scroll-to-dashcard.ts b/frontend/src/metabase/dashboard/hooks/use-auto-scroll-to-dashcard.tsindex 20f34eeda0b..1a1faa2e86c 100644--- a/frontend/src/metabase/dashboard/hooks/use-auto-scroll-to-dashcard.ts+++ b/frontend/src/metabase/dashboard/hooks/use-auto-scroll-to-dashcard.ts@@ -1,7 +1,7 @@-import type { LocationDescriptorObject } from "history";import { useCallback, useMemo } from "react";import { useDispatch } from "metabase/redux";+import type { LocationDescriptorObject } from "metabase/router";import { replace } from "metabase/router";import { parseHashOptions, stringifyHashOptions } from "metabase/utils/browser";import type { DashCardId } from "metabase-types/api";diff --git a/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.ts b/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.tsindex 3c9dd9470d1..4635d45d9c9 100644--- a/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.ts+++ b/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.ts@@ -1,4 +1,3 @@-import type { Location } from "history";import { useEffect, useMemo } from "react";import { usePrevious } from "react-use";import _ from "underscore";@@ -7,8 +6,12 @@ import { useSetting } from "metabase/common/hooks";import { isEmbedPreview } from "metabase/embedding/config";import { useDispatch, useSelector } from "metabase/redux";import { selectTab } from "metabase/redux/dashboard";-import type { InjectedRouter } from "metabase/router";-import { push, replace } from "metabase/router";+import {+ type InjectedRouter,+ type Location,+ push,+ replace,+} from "metabase/router";import * as Urls from "metabase/urls";import { getParameterValuesBySlug } from "metabase-lib/v1/parameters/utils/parameter-values";diff --git a/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.unit.spec.tsx b/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.unit.spec.tsxindex df5868b7f8d..ae58ffc5678 100644--- a/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.unit.spec.tsx+++ b/frontend/src/metabase/dashboard/hooks/use-dashboard-url-query.unit.spec.tsx@@ -1,5 +1,4 @@import { act } from "@testing-library/react";-import type { Location } from "history";import { renderHookWithProviders } from "__support__/ui";import { isEmbedPreview } from "metabase/embedding/config";@@ -10,6 +9,7 @@ import {createMockState,createMockStoreDashboard,} from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import { push, replace } from "metabase/router";import type { ParameterValueOrArray } from "metabase-types/api";import { createMockParameter } from "metabase-types/api/mocks";diff --git a/frontend/src/metabase/dashboard/hooks/use-location-sync.ts b/frontend/src/metabase/dashboard/hooks/use-location-sync.tsindex 91f3b57715e..21aa8f06d0d 100644--- a/frontend/src/metabase/dashboard/hooks/use-location-sync.ts+++ b/frontend/src/metabase/dashboard/hooks/use-location-sync.ts@@ -1,9 +1,9 @@-import type { Location } from "history";import { useEffect, useMemo } from "react";import { usePrevious } from "react-use";import { omit } from "underscore";import { useDispatch } from "metabase/redux";+import type { Location } from "metabase/router";import { replace } from "metabase/router";import { parseHashOptions, stringifyHashOptions } from "metabase/utils/browser";import { isNullOrUndefined } from "metabase/utils/types";diff --git a/frontend/src/metabase/dashboard/utils.ts b/frontend/src/metabase/dashboard/utils.tsindex 7c64817cb76..dc5a91d2f20 100644--- a/frontend/src/metabase/dashboard/utils.ts+++ b/frontend/src/metabase/dashboard/utils.ts@@ -1,9 +1,9 @@-import type { Location } from "history";import { getIn } from "icepick";import { msgid, ngettext, t } from "ttag";import _ from "underscore";import type { SelectedTabId } from "metabase/redux/store";+import type { Location } from "metabase/router";import {isQuestionDashCard,isVirtualDashCard,diff --git a/frontend/src/metabase/dashboard/utils.unit.spec.ts b/frontend/src/metabase/dashboard/utils.unit.spec.tsindex 0ad87b0fc12..a2171f4f6c0 100644--- a/frontend/src/metabase/dashboard/utils.unit.spec.ts+++ b/frontend/src/metabase/dashboard/utils.unit.spec.ts@@ -1,5 +1,3 @@-import type { Location } from "history";-import {canResetFilter,createTabSlug,@@ -16,6 +14,7 @@ import {syncParametersAndEmbeddingParams,} from "metabase/dashboard/utils";import { createMockLocation } from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import { SERVER_ERROR_TYPES } from "metabase/utils/errors";import { checkNotNull } from "metabase/utils/types";import { createMockUiParameter } from "metabase-lib/v1/parameters/mock";diff --git a/frontend/src/metabase/documents/components/DocumentPage.tsx b/frontend/src/metabase/documents/components/DocumentPage.tsxindex 6e2f33c59b6..a66946fa18e 100644--- a/frontend/src/metabase/documents/components/DocumentPage.tsx+++ b/frontend/src/metabase/documents/components/DocumentPage.tsx@@ -2,7 +2,6 @@ import { useForceUpdate } from "@mantine/hooks";import type { JSONContent, Editor as TiptapEditor } from "@tiptap/core";import type { Node as ProseMirrorNode } from "@tiptap/pm/model";import dayjs from "dayjs";-import type { Location } from "history";import {type ReactNode,useCallback,@@ -39,8 +38,13 @@ import { useCallbackEffect } from "metabase/common/hooks/use-callback-effect";import { usePageTitle } from "metabase/hooks/use-page-title";import { useDispatch, useSelector } from "metabase/redux";import { setErrorPage } from "metabase/redux/app";-import type { Route } from "metabase/router";-import { Outlet, push, replace } from "metabase/router";+import {+ type Location,+ Outlet,+ type Route,+ push,+ replace,+} from "metabase/router";import { Box } from "metabase/ui";import { extractEntityId } from "metabase/urls";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/history/HistoryProvider.tsx b/frontend/src/metabase/history/HistoryProvider.tsxindex b9c6e28008b..babfc5a3159 100644--- a/frontend/src/metabase/history/HistoryProvider.tsx+++ b/frontend/src/metabase/history/HistoryProvider.tsx@@ -1,6 +1,7 @@-import type { History } from "history";import { type PropsWithChildren, createContext } from "react";+import type { History } from "metabase/router";+type HistoryContextType = {history: History;};diff --git a/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.tsx b/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.tsxindex 89b0b9c5ce7..83a3e01e78c 100644--- a/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.tsx+++ b/frontend/src/metabase/metadata/pages/DataModelV1/DataModelV1.tsx@@ -1,5 +1,4 @@import { useDisclosure, useWindowEvent } from "@mantine/hooks";-import type { Location } from "history";import { useMemo, useState } from "react";import { t } from "ttag";import _ from "underscore";@@ -10,6 +9,7 @@ import {} from "metabase/api";import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { getRawTableFieldId } from "metabase/metadata/utils/field";+import type { Location } from "metabase/router";import { Outlet } from "metabase/router";import { Box, Flex, Stack, rem } from "metabase/ui";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/metrics-viewer/hooks/use-viewer-url.ts b/frontend/src/metabase/metrics-viewer/hooks/use-viewer-url.tsindex d0d217de904..b3b01baac9b 100644--- a/frontend/src/metabase/metrics-viewer/hooks/use-viewer-url.ts+++ b/frontend/src/metabase/metrics-viewer/hooks/use-viewer-url.ts@@ -1,9 +1,9 @@-import type { Location } from "history";import { useEffect, useRef } from "react";import { t } from "ttag";import { useToast } from "metabase/common/hooks";import { useDispatch } from "metabase/redux";+import type { Location } from "metabase/router";import { push, replace } from "metabase/router";import * as Urls from "metabase/urls";import type { MeasureId } from "metabase-types/api";diff --git a/frontend/src/metabase/metrics-viewer/pages/MetricsViewerPage/MetricsViewerPage.tsx b/frontend/src/metabase/metrics-viewer/pages/MetricsViewerPage/MetricsViewerPage.tsxindex 765c5d7791e..809b417755b 100644--- a/frontend/src/metabase/metrics-viewer/pages/MetricsViewerPage/MetricsViewerPage.tsx+++ b/frontend/src/metabase/metrics-viewer/pages/MetricsViewerPage/MetricsViewerPage.tsx@@ -1,5 +1,3 @@-import type { Location } from "history";-import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";import { BreakoutLegend } from "metabase/metrics-viewer/components/BreakoutLegend/BreakoutLegend";import { DimensionPickerSidebar } from "metabase/metrics-viewer/components/DimensionPickerSidebar";@@ -14,6 +12,7 @@ import {useMetricsViewerContext,} from "metabase/metrics-viewer/context";import { useViewerState } from "metabase/metrics-viewer/hooks";+import type { Location } from "metabase/router";import { Box, Center, Flex, Stack } from "metabase/ui";import S from "./MetricsViewerPage.module.css";diff --git a/frontend/src/metabase/metrics/pages/NewMetricPage/NewMetricPage.tsx b/frontend/src/metabase/metrics/pages/NewMetricPage/NewMetricPage.tsxindex 81528f8441e..10865e50cf5 100644--- a/frontend/src/metabase/metrics/pages/NewMetricPage/NewMetricPage.tsx+++ b/frontend/src/metabase/metrics/pages/NewMetricPage/NewMetricPage.tsx@@ -1,7 +1,5 @@import { useDisclosure } from "@mantine/hooks";-import type { Location } from "history";-import type { ReactNode } from "react";-import { useMemo, useState } from "react";+import { type ReactNode, useMemo, useState } from "react";import { t } from "ttag";import { useGetDefaultCollectionId } from "metabase/common/collections/hooks";@@ -18,8 +16,7 @@ import { MetricQueryEditor } from "metabase/metrics/components/MetricQueryEditorimport { NAME_MAX_LENGTH } from "metabase/metrics/constants";import { getInitialUiState } from "metabase/querying/editor/components/QueryEditor";import { useDispatch, useSelector } from "metabase/redux";-import type { Route } from "metabase/router";-import { goBack, push } from "metabase/router";+import { type Location, type Route, goBack, push } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import { Breadcrumbs, Card, Icon } from "metabase/ui";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/models/containers/ModelActions/ModelActions.tsx b/frontend/src/metabase/models/containers/ModelActions/ModelActions.tsxindex 9ad84b01e83..4a3bc047443 100644--- a/frontend/src/metabase/models/containers/ModelActions/ModelActions.tsx+++ b/frontend/src/metabase/models/containers/ModelActions/ModelActions.tsx@@ -1,4 +1,3 @@-import type { LocationDescriptor } from "history";import { useEffect, useMemo, useState } from "react";import { useMount } from "react-use";@@ -16,6 +15,7 @@ import { loadMetadataForCard } from "metabase/questions/actions";import { connect, useSelector } from "metabase/redux";import type { State } from "metabase/redux/store";import { fetchTableForeignKeys } from "metabase/redux/tables";+import type { LocationDescriptor } from "metabase/router";import { Outlet, replace } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/models/containers/NewModelOptions/NewModelOptions.tsx b/frontend/src/metabase/models/containers/NewModelOptions/NewModelOptions.tsxindex 10579a62b93..86e59288f68 100644--- a/frontend/src/metabase/models/containers/NewModelOptions/NewModelOptions.tsx+++ b/frontend/src/metabase/models/containers/NewModelOptions/NewModelOptions.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { t } from "ttag";import { ExternalLink } from "metabase/common/components/ExternalLink";@@ -7,6 +6,7 @@ import { NoDatabasesEmptyState } from "metabase/common/components/NoDatabasesEmpimport CS from "metabase/css/core/index.css";import { NewModelOption } from "metabase/models/components/NewModelOption";import { useSelector } from "metabase/redux";+import type { Location } from "metabase/router";import { getLearnUrl, getSetting } from "metabase/selectors/settings";import {canUserCreateNativeQueries,diff --git a/frontend/src/metabase/monitor/tools/components/Logs/Logs.unit.spec.tsx b/frontend/src/metabase/monitor/tools/components/Logs/Logs.unit.spec.tsxindex d34422f10f6..9a1a13d08f8 100644--- a/frontend/src/metabase/monitor/tools/components/Logs/Logs.unit.spec.tsx+++ b/frontend/src/metabase/monitor/tools/components/Logs/Logs.unit.spec.tsx@@ -1,11 +1,11 @@import fetchMock from "fetch-mock";-import type { Location } from "history";import { act, renderWithProviders, screen, waitFor } from "__support__/ui";import {createMockLocation,createMockRoutingState,} from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import { Route } from "metabase/router";import { DEFAULT_POLLING_DURATION_MS, Logs } from "./Logs";diff --git a/frontend/src/metabase/monitor/tools/components/TaskListPage/TaskListPage.unit.spec.tsx b/frontend/src/metabase/monitor/tools/components/TaskListPage/TaskListPage.unit.spec.tsxindex c36e9589be7..f3e13b5e2bb 100644--- a/frontend/src/metabase/monitor/tools/components/TaskListPage/TaskListPage.unit.spec.tsx+++ b/frontend/src/metabase/monitor/tools/components/TaskListPage/TaskListPage.unit.spec.tsx@@ -1,6 +1,5 @@import userEvent from "@testing-library/user-event";import fetchMock from "fetch-mock";-import type { Location } from "history";import {setupDatabasesEndpoints,@@ -17,6 +16,7 @@ import {} from "__support__/ui";import { URL_UPDATE_DEBOUNCE_DELAY } from "metabase/common/hooks/use-url-state";import { createMockLocation } from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import { Route, withRouteProps } from "metabase/router";import * as Urls from "metabase/urls";import type { ListTasksResponse } from "metabase-types/api";diff --git a/frontend/src/metabase/monitor/tools/components/ToolsApp.tsx b/frontend/src/metabase/monitor/tools/components/ToolsApp.tsxindex ea24132c435..3884791fe2f 100644--- a/frontend/src/metabase/monitor/tools/components/ToolsApp.tsx+++ b/frontend/src/metabase/monitor/tools/components/ToolsApp.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { t } from "ttag";import { AdminSettingsLayout } from "metabase/admin/components/AdminLayout/AdminSettingsLayout";@@ -7,6 +6,7 @@ import {type AdminNavItemProps,AdminNavWrapper,} from "metabase/admin/components/AdminNav";+import type { Location } from "metabase/router";import { Outlet } from "metabase/router";import * as Urls from "metabase/urls";diff --git a/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.tsx b/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.tsxindex d1751ec4c04..1d0ed2749e3 100644--- a/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.tsx+++ b/frontend/src/metabase/nav/components/search/SearchBar/SearchBar.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { LocationDescriptorObject } from "history";import { useKBar } from "kbar";import type {ChangeEvent,@@ -22,6 +21,7 @@ import { RecentsList } from "metabase/nav/components/search/RecentsList";import { SearchResultsDropdown } from "metabase/nav/components/search/SearchResultsDropdown";import { APP_BAR_HEIGHT } from "metabase/nav/constants";import { useDispatch, useSelector } from "metabase/redux";+import type { LocationDescriptorObject } from "metabase/router";import { push, useRouter } from "metabase/router";import { getSetting } from "metabase/selectors/settings";import { Box, Flex, Icon, UnstyledButton, rem } from "metabase/ui";diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbar.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbar.tsxindex 658e3b98ea5..ae24efcb413 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbar.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbar.tsx@@ -1,4 +1,3 @@-import type { LocationDescriptor } from "history";import { useEffect, useMemo } from "react";import {@@ -10,6 +9,7 @@ import { NavbarPromoSlot } from "metabase/nav/components/NavbarPromoSlot";import { connect } from "metabase/redux";import { closeNavbar, openNavbar } from "metabase/redux/app";import type { State } from "metabase/redux/store";+import type { LocationDescriptor } from "metabase/router";import { push } from "metabase/router";import * as Urls from "metabase/urls";import Question from "metabase-lib/v1/Question";diff --git a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsx b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsxindex 8a54a2a5e2c..c5ed15fb467 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsx+++ b/frontend/src/metabase/nav/containers/MainNavbar/MainNavbarContainer/MainNavbarContainer.tsx@@ -1,4 +1,3 @@-import type { LocationDescriptor } from "history";import { memo, useCallback, useMemo, useState } from "react";import { t } from "ttag";@@ -23,6 +22,7 @@ import { connect, useDispatch, useSelector } from "metabase/redux";import { logout } from "metabase/redux/auth";import type { State } from "metabase/redux/store";import { addUndo } from "metabase/redux/undo";+import type { LocationDescriptor } from "metabase/router";import {getIsTenantUser,getUser,diff --git a/frontend/src/metabase/nav/containers/MainNavbar/types.ts b/frontend/src/metabase/nav/containers/MainNavbar/types.tsindex 3905b7190ae..7f541bf6d39 100644--- a/frontend/src/metabase/nav/containers/MainNavbar/types.ts+++ b/frontend/src/metabase/nav/containers/MainNavbar/types.ts@@ -1,6 +1,5 @@-import type { Location } from "history";-import type { StoreDashboard } from "metabase/redux/store";+import type { Location } from "metabase/router";export interface MainNavbarOwnProps {isOpen: boolean;diff --git a/frontend/src/metabase/palette/components/Palette.tsx b/frontend/src/metabase/palette/components/Palette.tsxindex 67ed891f1e0..aeccbe1b587 100644--- a/frontend/src/metabase/palette/components/Palette.tsx+++ b/frontend/src/metabase/palette/components/Palette.tsx@@ -1,10 +1,9 @@-import type { Query } from "history";import { KBarPortal, VisualState, useKBar } from "kbar";import { useEffect, useRef } from "react";import { useOnClickOutside } from "metabase/common/hooks/use-on-click-outside";import { useSelector } from "metabase/redux";-import { type PlainRoute, useRouter } from "metabase/router";+import { type PlainRoute, type Query, useRouter } from "metabase/router";import { getUser } from "metabase/selectors/user";import { Box, Card, Center, Icon, Overlay, Stack, rem } from "metabase/ui";import { isWithinIframe } from "metabase/utils/iframe";diff --git a/frontend/src/metabase/palette/components/PaletteResults.tsx b/frontend/src/metabase/palette/components/PaletteResults.tsxindex 5c6ea4eeedf..f27ed1ba8a0 100644--- a/frontend/src/metabase/palette/components/PaletteResults.tsx+++ b/frontend/src/metabase/palette/components/PaletteResults.tsx@@ -1,4 +1,3 @@-import type { Query } from "history";import { VisualState, useKBar, useMatches } from "kbar";import { useEffect, useMemo } from "react";import { useKeyPressEvent } from "react-use";@@ -7,6 +6,7 @@ import { t } from "ttag";import NoResults from "assets/img/no_results.svg";import { useShowOtherUsersCollections } from "metabase/common/hooks/use-show-other-users-collections";import { trackSearchClick } from "metabase/common/search/analytics";+import type { Query } from "metabase/router";import { Link } from "metabase/router";import {Flex,diff --git a/frontend/src/metabase/palette/hooks/useCommandPalette.tsx b/frontend/src/metabase/palette/hooks/useCommandPalette.tsxindex 905422e9304..71a77215764 100644--- a/frontend/src/metabase/palette/hooks/useCommandPalette.tsx+++ b/frontend/src/metabase/palette/hooks/useCommandPalette.tsx@@ -1,4 +1,3 @@-import type { Query } from "history";import { Priority, VisualState, useKBar, useRegisterActions } from "kbar";import { type PropsWithChildren, useEffect, useMemo, useState } from "react";import { useDebounce } from "react-use";@@ -12,6 +11,7 @@ import { useSetting } from "metabase/common/hooks";import { trackSearchClick } from "metabase/common/search/analytics";import { useGetIcon } from "metabase/hooks/use-icon";import { useSelector } from "metabase/redux";+import type { Query } from "metabase/router";import { getDocsUrl, getSettings } from "metabase/selectors/settings";import { canAccessSettings, getUserIsAdmin } from "metabase/selectors/user";import { getShowMetabaseLinks } from "metabase/selectors/whitelabel";diff --git a/frontend/src/metabase/palette/types.ts b/frontend/src/metabase/palette/types.tsindex 1b6c64549b1..5afbf7e9c4d 100644--- a/frontend/src/metabase/palette/types.ts+++ b/frontend/src/metabase/palette/types.ts@@ -1,7 +1,7 @@-import type { LocationDescriptor } from "history";import type { Action, ActionImpl } from "kbar";import type React from "react";+import type { LocationDescriptor } from "metabase/router";import type { ColorName } from "metabase/ui/colors/types";import type { IconName, ModerationReviewStatus } from "metabase-types/api";diff --git a/frontend/src/metabase/palette/utils.ts b/frontend/src/metabase/palette/utils.tsindex 3b8f4657e6b..e21e962af38 100644--- a/frontend/src/metabase/palette/utils.ts+++ b/frontend/src/metabase/palette/utils.ts@@ -1,7 +1,7 @@-import type { LocationDescriptor } from "history";import { t } from "ttag";import _ from "underscore";+import type { LocationDescriptor } from "metabase/router";import type { ColorName } from "metabase/ui/colors/types";import type { IconName, RecentItem } from "metabase-types/api";diff --git a/frontend/src/metabase/palette/utils.unit.spec.ts b/frontend/src/metabase/palette/utils.unit.spec.tsindex d6d36a30b59..211c998674e 100644--- a/frontend/src/metabase/palette/utils.unit.spec.ts+++ b/frontend/src/metabase/palette/utils.unit.spec.ts@@ -1,4 +1,4 @@-import type { LocationDescriptor } from "history";+import type { LocationDescriptor } from "metabase/router";import type { PaletteActionImpl } from "./types";import {diff --git a/frontend/src/metabase/public/containers/PublicDocument/PublicDocument.tsx b/frontend/src/metabase/public/containers/PublicDocument/PublicDocument.tsxindex 0407e9ca362..ecb89c55900 100644--- a/frontend/src/metabase/public/containers/PublicDocument/PublicDocument.tsx+++ b/frontend/src/metabase/public/containers/PublicDocument/PublicDocument.tsx@@ -1,7 +1,6 @@import Image from "@tiptap/extension-image";import { Link } from "@tiptap/extension-link";import { EditorContent, useEditor } from "@tiptap/react";-import type { Location } from "history";import { useEffect, useMemo } from "react";import { useAsync, useMount } from "react-use";@@ -24,6 +23,7 @@ import { ResizeNode } from "metabase/rich_text_editing/tiptap/extensions/ResizeNimport { SmartLink } from "metabase/rich_text_editing/tiptap/extensions/SmartLink/SmartLinkNode";import { SupportingText } from "metabase/rich_text_editing/tiptap/extensions/SupportingText/SupportingText";import { DROP_ZONE_COLOR } from "metabase/rich_text_editing/tiptap/extensions/shared/constants";+import type { Location } from "metabase/router";import { getSetting } from "metabase/selectors/settings";import { Box } from "metabase/ui";import { initializeIframeResizer } from "metabase/utils/dom";diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsxindex 22eb8071e3b..048e7709bbe 100644--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestion.tsx@@ -1,4 +1,3 @@-import type { Location } from "history";import { useCallback, useEffect, useState } from "react";import { useLatest, useMount } from "react-use";@@ -15,6 +14,7 @@ import { useSetEmbedFont } from "metabase/public/hooks/use-set-embed-font";import { useDispatch, useSelector } from "metabase/redux";import { setErrorPage } from "metabase/redux/app";import { updateMetadata } from "metabase/redux/metadata";+import type { Location } from "metabase/router";import { FieldSchema } from "metabase/schema";import { getMetadata } from "metabase/selectors/metadata";import { getCanWhitelabel } from "metabase/selectors/whitelabel";diff --git a/frontend/src/metabase/public/hooks/use-embed-frame-options.ts b/frontend/src/metabase/public/hooks/use-embed-frame-options.tsindex e7e690c6c5e..c45d11a52cd 100644--- a/frontend/src/metabase/public/hooks/use-embed-frame-options.ts+++ b/frontend/src/metabase/public/hooks/use-embed-frame-options.ts@@ -1,9 +1,9 @@-import type { Location } from "history";import { useEffect } from "react";import { useDocsUrl } from "metabase/common/hooks";import type { EmbeddingHashOptions } from "metabase/embedding/types";import { PLUGIN_RESOURCE_DOWNLOADS } from "metabase/plugins";+import type { Location } from "metabase/router";import { parseHashOptions } from "metabase/utils/browser";import { isWithinIframe } from "metabase/utils/iframe";diff --git a/frontend/src/metabase/public/hooks/use-set-embed-font.ts b/frontend/src/metabase/public/hooks/use-set-embed-font.tsindex 4cf4e33b37a..880954fc3db 100644--- a/frontend/src/metabase/public/hooks/use-set-embed-font.ts+++ b/frontend/src/metabase/public/hooks/use-set-embed-font.ts@@ -1,9 +1,9 @@-import type { Location } from "history";import { useEffect } from "react";import type { EmbeddingHashOptions } from "metabase/embedding/types";import { useDispatch } from "metabase/redux";import { setOptions } from "metabase/redux/embed";+import type { Location } from "metabase/router";import { parseHashOptions } from "metabase/utils/browser";export const useSetEmbedFont = ({ location }: { location: Location }) => {diff --git a/frontend/src/metabase/public/hooks/use-set-embed-font.unit.spec.tsx b/frontend/src/metabase/public/hooks/use-set-embed-font.unit.spec.tsxindex 2370ed00059..f82f9c4c76f 100644--- a/frontend/src/metabase/public/hooks/use-set-embed-font.unit.spec.tsx+++ b/frontend/src/metabase/public/hooks/use-set-embed-font.unit.spec.tsx@@ -1,11 +1,11 @@import { renderHook } from "@testing-library/react";-import type { Location } from "history";import type { PropsWithChildren } from "react";import { mainReducers } from "__support__/entities-store";import { MetabaseReduxProvider } from "metabase/redux";import type { EmbedState } from "metabase/redux/store";import { createMockState } from "metabase/redux/store/mocks";+import type { Location } from "metabase/router";import { getStore } from "metabase/store";import { useSetEmbedFont } from "./use-set-embed-font";diff --git a/frontend/src/metabase/query_builder/actions/core/initializeQB.ts b/frontend/src/metabase/query_builder/actions/core/initializeQB.tsindex 4d56b664052..b51b1a7488b 100644--- a/frontend/src/metabase/query_builder/actions/core/initializeQB.ts+++ b/frontend/src/metabase/query_builder/actions/core/initializeQB.ts@@ -1,5 +1,3 @@-import type { LocationDescriptorObject } from "history";-import { cardApi, databaseApi, snippetApi } from "metabase/api";import { runRtkEndpoint } from "metabase/api/utils/run-rtk-endpoint";import {@@ -22,6 +20,7 @@ import type {QueryBuilderUIControls,} from "metabase/redux/store";import { fetchTableMetadataAndForeignKeys } from "metabase/redux/tables";+import type { LocationDescriptorObject } from "metabase/router";import { replace } from "metabase/router";import { FieldSchema } from "metabase/schema";import { getMetadata } from "metabase/selectors/metadata";diff --git a/frontend/src/metabase/query_builder/actions/core/initializeQB.unit.spec.ts b/frontend/src/metabase/query_builder/actions/core/initializeQB.unit.spec.tsindex ae124eff7b6..06367e90ff0 100644--- a/frontend/src/metabase/query_builder/actions/core/initializeQB.unit.spec.ts+++ b/frontend/src/metabase/query_builder/actions/core/initializeQB.unit.spec.ts@@ -1,5 +1,4 @@import fetchMock from "fetch-mock";-import type { LocationDescriptorObject } from "history";import { createMockEntitiesState } from "__support__/store";import { databaseApi, snippetApi } from "metabase/api";@@ -10,6 +9,7 @@ import { setErrorPage } from "metabase/redux/app";import * as metadataActions from "metabase/redux/metadata";import * as sharedQB from "metabase/redux/query-builder";import { createMockState } from "metabase/redux/store/mocks";+import type { LocationDescriptorObject } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import * as Urls from "metabase/urls";import { defer } from "metabase/utils/promise";diff --git a/frontend/src/metabase/query_builder/actions/navigation.ts b/frontend/src/metabase/query_builder/actions/navigation.tsindex 9bc76494197..33685c55df1 100644--- a/frontend/src/metabase/query_builder/actions/navigation.ts+++ b/frontend/src/metabase/query_builder/actions/navigation.ts@@ -1,9 +1,9 @@-import type { Location } from "history";import _ from "underscore";import { createThunkAction } from "metabase/redux";import { resetUIControls } from "metabase/redux/query-builder";import type { Dispatch } from "metabase/redux/store";+import type { Location } from "metabase/router";import { getLocation } from "metabase/selectors/routing";import {diff --git a/frontend/src/metabase/query_builder/actions/navigation.unit.spec.ts b/frontend/src/metabase/query_builder/actions/navigation.unit.spec.tsindex ec2a7fb9d14..ef5375bc4c4 100644--- a/frontend/src/metabase/query_builder/actions/navigation.unit.spec.ts+++ b/frontend/src/metabase/query_builder/actions/navigation.unit.spec.ts@@ -2,7 +2,7 @@// produces the pushes. locationChanged decides between re-running initializeQB// and dispatching popState based on location.action plus location.state. The// router migration re-plumbs this read seam, so this locks the current matrix.-import type { Location } from "history";+import type { Location } from "metabase/router";import * as initializeQBModule from "./core/initializeQB";import { locationChanged } from "./navigation";diff --git a/frontend/src/metabase/query_builder/actions/url.ts b/frontend/src/metabase/query_builder/actions/url.tsindex 21140533d8e..34918e5f351 100644--- a/frontend/src/metabase/query_builder/actions/url.ts+++ b/frontend/src/metabase/query_builder/actions/url.ts@@ -1,9 +1,8 @@import { parse as parseUrl } from "url";-import type { LocationDescriptor } from "history";-import { isEqualCard } from "metabase/common/utils/card";import { createThunkAction } from "metabase/redux";+import type { LocationDescriptor } from "metabase/router";import { push, replace } from "metabase/router";import { getBasename } from "metabase/utils/basename";import * as Lib from "metabase-lib";diff --git a/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx b/frontend/src/metabase/query_builder/containers/QueryBuilder.tsxindex cde80886475..a003cdff2f5 100644--- a/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx+++ b/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx@@ -1,5 +1,4 @@import { useHotkeys } from "@mantine/hooks";-import type { Location } from "history";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import type { ConnectedProps } from "react-redux";import { useMount, usePrevious, useUnmount } from "react-use";@@ -51,8 +50,12 @@ import {setUIControls,} from "metabase/redux/query-builder";import type { QueryBuilderUIControls, State } from "metabase/redux/store";-import type { Route, WithRouterProps } from "metabase/router";-import { push } from "metabase/router";+import {+ type Location,+ type Route,+ type WithRouterProps,+ push,+} from "metabase/router";import { getIsNavbarOpen } from "metabase/selectors/app";import { getMetadata } from "metabase/selectors/metadata";import { getSetting } from "metabase/selectors/settings";diff --git a/frontend/src/metabase/query_builder/typed-utils.ts b/frontend/src/metabase/query_builder/typed-utils.tsindex 349dcb81888..6d35634d4b4 100644--- a/frontend/src/metabase/query_builder/typed-utils.ts+++ b/frontend/src/metabase/query_builder/typed-utils.ts@@ -1,6 +1,5 @@-import type { LocationDescriptorObject } from "history";-import type { DatasetEditorTab, QueryBuilderMode } from "metabase/redux/store";+import type { LocationDescriptorObject } from "metabase/router";type LocationQBModeResult = {queryBuilderMode: QueryBuilderMode;diff --git a/frontend/src/metabase/query_builder/utils/index.ts b/frontend/src/metabase/query_builder/utils/index.tsindex 3da729cb055..ae3cff14c5c 100644--- a/frontend/src/metabase/query_builder/utils/index.ts+++ b/frontend/src/metabase/query_builder/utils/index.ts@@ -1,10 +1,10 @@import querystring from "querystring";-import type { Location } from "history";import _ from "underscore";import { serializeCardForUrl } from "metabase/common/utils/card";import type { DatasetEditorTab, QueryBuilderMode } from "metabase/redux/store";+import type { Location } from "metabase/router";import * as Urls from "metabase/urls";import * as Lib from "metabase-lib";import type Question from "metabase-lib/v1/Question";diff --git a/frontend/src/metabase/redux/store/mocks/routing.ts b/frontend/src/metabase/redux/store/mocks/routing.tsindex bb97e0a0baf..51dc58af17b 100644--- a/frontend/src/metabase/redux/store/mocks/routing.ts+++ b/frontend/src/metabase/redux/store/mocks/routing.ts@@ -1,6 +1,4 @@-import type { Location } from "history";--import type { RouterState } from "metabase/router";+import type { Location, RouterState } from "metabase/router";export const createMockRoutingState = (opts?: Partial<RouterState>,diff --git a/frontend/src/metabase/reference/databases/DatabaseDetailContainer.tsx b/frontend/src/metabase/reference/databases/DatabaseDetailContainer.tsxindex 7a7a4189679..6f337662655 100644--- a/frontend/src/metabase/reference/databases/DatabaseDetailContainer.tsx+++ b/frontend/src/metabase/reference/databases/DatabaseDetailContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,15 +7,21 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import DatabaseDetail from "metabase/reference/databases/DatabaseDetail";import * as actions from "metabase/reference/reference";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getDatabase,+ getDatabaseId,+ getIsEditing,} from "../selectors";-import { getDatabase, getDatabaseId, getIsEditing } from "../selectors";import type { StubbedDatabase } from "../types";import DatabaseSidebar from "./DatabaseSidebar";diff --git a/frontend/src/metabase/reference/databases/FieldDetailContainer.tsx b/frontend/src/metabase/reference/databases/FieldDetailContainer.tsxindex 5fccc648271..9fe36bc40d8 100644--- a/frontend/src/metabase/reference/databases/FieldDetailContainer.tsx+++ b/frontend/src/metabase/reference/databases/FieldDetailContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,16 +7,18 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import FieldDetail from "metabase/reference/databases/FieldDetail";import * as actions from "metabase/reference/reference";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,-} from "../selectors";import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,getDatabase,getDatabaseId,getField,diff --git a/frontend/src/metabase/reference/databases/FieldListContainer.tsx b/frontend/src/metabase/reference/databases/FieldListContainer.tsxindex a962d12e816..690d22f6fe6 100644--- a/frontend/src/metabase/reference/databases/FieldListContainer.tsx+++ b/frontend/src/metabase/reference/databases/FieldListContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,15 +7,17 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import FieldList from "metabase/reference/databases/FieldList";import * as actions from "metabase/reference/reference";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,-} from "../selectors";import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,getDatabase,getDatabaseId,getIsEditing,diff --git a/frontend/src/metabase/reference/databases/TableDetailContainer.tsx b/frontend/src/metabase/reference/databases/TableDetailContainer.tsxindex 60d3f766e22..120da28ff56 100644--- a/frontend/src/metabase/reference/databases/TableDetailContainer.tsx+++ b/frontend/src/metabase/reference/databases/TableDetailContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,15 +7,17 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import TableDetail from "metabase/reference/databases/TableDetail";import * as actions from "metabase/reference/reference";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,-} from "../selectors";import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,getDatabase,getDatabaseId,getIsEditing,diff --git a/frontend/src/metabase/reference/databases/TableListContainer.tsx b/frontend/src/metabase/reference/databases/TableListContainer.tsxindex 507d20afe4b..079770fcabb 100644--- a/frontend/src/metabase/reference/databases/TableListContainer.tsx+++ b/frontend/src/metabase/reference/databases/TableListContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,15 +7,21 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import TableList from "metabase/reference/databases/TableList";import * as actions from "metabase/reference/reference";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getDatabase,+ getDatabaseId,+ getIsEditing,} from "../selectors";-import { getDatabase, getDatabaseId, getIsEditing } from "../selectors";import type { StubbedDatabase } from "../types";import DatabaseSidebar from "./DatabaseSidebar";diff --git a/frontend/src/metabase/reference/databases/TableQuestionsContainer.tsx b/frontend/src/metabase/reference/databases/TableQuestionsContainer.tsxindex fdc1b02e4df..e6f72b28598 100644--- a/frontend/src/metabase/reference/databases/TableQuestionsContainer.tsx+++ b/frontend/src/metabase/reference/databases/TableQuestionsContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import { cardApi } from "metabase/api";@@ -11,15 +10,17 @@ import type { Dispatch } from "metabase/redux/store";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import TableQuestions from "metabase/reference/databases/TableQuestions";import * as actions from "metabase/reference/reference";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,-} from "../selectors";import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,getDatabase,getDatabaseId,getIsEditing,diff --git a/frontend/src/metabase/reference/segments/SegmentDetailContainer.tsx b/frontend/src/metabase/reference/segments/SegmentDetailContainer.tsxindex 69200df4b91..13e451e875a 100644--- a/frontend/src/metabase/reference/segments/SegmentDetailContainer.tsx+++ b/frontend/src/metabase/reference/segments/SegmentDetailContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,16 +7,23 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import * as actions from "metabase/reference/reference";import SegmentDetail from "metabase/reference/segments/SegmentDetail";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { User } from "metabase-types/api";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getIsEditing,+ getSegment,+ getSegmentId,+ getUser,} from "../selectors";-import { getIsEditing, getSegment, getSegmentId, getUser } from "../selectors";import type { StubbedSegment } from "../types";import SegmentSidebar from "./SegmentSidebar";diff --git a/frontend/src/metabase/reference/segments/SegmentFieldDetailContainer.tsx b/frontend/src/metabase/reference/segments/SegmentFieldDetailContainer.tsxindex d4e004264c5..6be64ddcc95 100644--- a/frontend/src/metabase/reference/segments/SegmentFieldDetailContainer.tsx+++ b/frontend/src/metabase/reference/segments/SegmentFieldDetailContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,15 +7,22 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import * as actions from "metabase/reference/reference";import SegmentFieldDetail from "metabase/reference/segments/SegmentFieldDetail";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getField,+ getIsEditing,+ getSegment,+ getSegmentId,} from "../selectors";-import { getField, getIsEditing, getSegment, getSegmentId } from "../selectors";import type { StubbedField, StubbedSegment } from "../types";import SegmentFieldSidebar from "./SegmentFieldSidebar";diff --git a/frontend/src/metabase/reference/segments/SegmentFieldListContainer.tsx b/frontend/src/metabase/reference/segments/SegmentFieldListContainer.tsxindex cf16bc86446..3369341a0f0 100644--- a/frontend/src/metabase/reference/segments/SegmentFieldListContainer.tsx+++ b/frontend/src/metabase/reference/segments/SegmentFieldListContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,16 +7,18 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import * as actions from "metabase/reference/reference";import SegmentFieldList from "metabase/reference/segments/SegmentFieldList";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { User } from "metabase-types/api";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,-} from "../selectors";import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,getIsEditing,getSegment,getSegmentId,diff --git a/frontend/src/metabase/reference/segments/SegmentListContainer.tsx b/frontend/src/metabase/reference/segments/SegmentListContainer.tsxindex 395c570b0d1..703da4dbdd2 100644--- a/frontend/src/metabase/reference/segments/SegmentListContainer.tsx+++ b/frontend/src/metabase/reference/segments/SegmentListContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -9,15 +8,20 @@ import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import BaseSidebar from "metabase/reference/guide/BaseSidebar";import * as actions from "metabase/reference/reference";import { SegmentList } from "metabase/reference/segments/SegmentList";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getDatabaseId,+ getIsEditing,} from "../selectors";-import { getDatabaseId, getIsEditing } from "../selectors";const mapStateToProps = (state: StateWithReference,diff --git a/frontend/src/metabase/reference/segments/SegmentQuestionsContainer.tsx b/frontend/src/metabase/reference/segments/SegmentQuestionsContainer.tsxindex e8bdb493024..c0c38616cd2 100644--- a/frontend/src/metabase/reference/segments/SegmentQuestionsContainer.tsx+++ b/frontend/src/metabase/reference/segments/SegmentQuestionsContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import { cardApi } from "metabase/api";@@ -11,16 +10,23 @@ import type { Dispatch } from "metabase/redux/store";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import * as actions from "metabase/reference/reference";import { SegmentQuestions } from "metabase/reference/segments/SegmentQuestions";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { User } from "metabase-types/api";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getIsEditing,+ getSegment,+ getSegmentId,+ getUser,} from "../selectors";-import { getIsEditing, getSegment, getSegmentId, getUser } from "../selectors";import type { StubbedSegment } from "../types";import SegmentSidebar from "./SegmentSidebar";diff --git a/frontend/src/metabase/reference/segments/SegmentRevisionsContainer.tsx b/frontend/src/metabase/reference/segments/SegmentRevisionsContainer.tsxindex ecbe1ac06e2..2ff82251754 100644--- a/frontend/src/metabase/reference/segments/SegmentRevisionsContainer.tsx+++ b/frontend/src/metabase/reference/segments/SegmentRevisionsContainer.tsx@@ -1,5 +1,4 @@import cx from "classnames";-import type { Location } from "history";import { Component } from "react";import CS from "metabase/css/core/index.css";@@ -8,16 +7,23 @@ import * as metadataActions from "metabase/redux/metadata";import { SidebarLayout } from "metabase/reference/components/SidebarLayout";import * as actions from "metabase/reference/reference";import SegmentRevisions from "metabase/reference/segments/SegmentRevisions";-import { type InjectedRouteProps, withRouteProps } from "metabase/router";+import {+ type InjectedRouteProps,+ type Location,+ withRouteProps,+} from "metabase/router";import type { User } from "metabase-types/api";import type { ClearStateProps, FetchProps } from "../reference";-import type {- ReferenceRouteParams,- ReferenceRouteProps,- StateWithReference,+import {+ type ReferenceRouteParams,+ type ReferenceRouteProps,+ type StateWithReference,+ getIsEditing,+ getSegment,+ getSegmentId,+ getUser,} from "../selectors";-import { getIsEditing, getSegment, getSegmentId, getUser } from "../selectors";import type { StubbedSegment } from "../types";import SegmentSidebar from "./SegmentSidebar";diff --git a/frontend/src/metabase/router/RouterProvider.tsx b/frontend/src/metabase/router/RouterProvider.tsxindex 0546af6826d..0aa426c65c1 100644--- a/frontend/src/metabase/router/RouterProvider.tsx+++ b/frontend/src/metabase/router/RouterProvider.tsx@@ -1,4 +1,3 @@-import type { History } from "history";import { type PropsWithChildren, createContext, useMemo } from "react";import { useHistory } from "metabase/history";@@ -10,6 +9,7 @@ import {type WithRouterProps,reactRouterWithRouter,} from "./react-router";+import type { History } from "./types";import { RouterProviderV7 } from "./v7/RouterProviderV7";type RouterContextType = WithRouterProps;diff --git a/frontend/src/metabase/router/guards.tsx b/frontend/src/metabase/router/guards.tsxindex db8d3c66ed5..580ce1d5d5b 100644--- a/frontend/src/metabase/router/guards.tsx+++ b/frontend/src/metabase/router/guards.tsx@@ -103,7 +103,9 @@ type GuardSelectors = {*/function createGuard({ isAllowed, isAuthenticating = NEVER_AUTHENTICATING }: GuardSelectors,- renderRedirect: (location: Location) => ReactElement | null,+ renderRedirect: (+ location: Omit<Location, "query" | "action">,+ ) => ReactElement | null,) {return function Guard({ children = <Outlet /> }: Props) {const location = useLocation();@@ -140,7 +142,7 @@ function FullPageRedirect({ to }: { to: string }): null {return null;}-const loginUrlWithRedirect = (location: Location) => {+const loginUrlWithRedirect = (location: Omit<Location, "query" | "action">) => {const from = `${location.pathname}${location.search}`;const query = new URLSearchParams({ redirect: from }).toString();return `/auth/login?${query}`;diff --git a/frontend/src/metabase/router/middleware.ts b/frontend/src/metabase/router/middleware.tsindex 74ae765dae2..1fc4439944d 100644--- a/frontend/src/metabase/router/middleware.ts+++ b/frontend/src/metabase/router/middleware.ts@@ -1,11 +1,11 @@import type { Middleware } from "@reduxjs/toolkit";-import type { History } from "history";import { match } from "ts-pattern";import {CALL_HISTORY_METHOD,type CallHistoryMethodAction,} from "./navigation";+import type { History } from "./types";/*** The slice of `history` the middleware drives. v3's `History` satisfies it, anddiff --git a/frontend/src/metabase/router/navigation.ts b/frontend/src/metabase/router/navigation.tsindex 83e05b8c2c1..3c1b22a7809 100644--- a/frontend/src/metabase/router/navigation.ts+++ b/frontend/src/metabase/router/navigation.ts@@ -1,4 +1,4 @@-import type { LocationDescriptor } from "history";+import type { LocationDescriptor } from "./types";/*** Re-owned equivalent of react-router-redux's navigation action creators.diff --git a/frontend/src/metabase/router/routing-reducer.ts b/frontend/src/metabase/router/routing-reducer.tsindex 517300fe9da..4eee88eb95d 100644--- a/frontend/src/metabase/router/routing-reducer.ts+++ b/frontend/src/metabase/router/routing-reducer.ts@@ -1,5 +1,6 @@import type { Action } from "@reduxjs/toolkit";-import type { Location } from "history";++import type { Location } from "./types";/*** Re-owned equivalent of react-router-redux's `routerReducer`.diff --git a/frontend/src/metabase/router/sync.ts b/frontend/src/metabase/router/sync.tsindex 69217a4b48c..5fe95bf06f4 100644--- a/frontend/src/metabase/router/sync.ts+++ b/frontend/src/metabase/router/sync.ts@@ -1,6 +1,5 @@-import type { History } from "history";-import { LOCATION_CHANGE, type RouterState } from "./routing-reducer";+import type { History } from "./types";// Only the slice of the redux store `sync` actually touches. Declared// structurally rather than as `Store<State>` so this leaf does not instantiatediff --git a/frontend/src/metabase/router/types.ts b/frontend/src/metabase/router/types.tsindex ecba94122bb..8b3cb6d5b4b 100644--- a/frontend/src/metabase/router/types.ts+++ b/frontend/src/metabase/router/types.ts@@ -18,19 +18,104 @@ export interface Path {export type To = string | Partial<Path>;/**- * An entry in a history stack. A location contains information about the URL- * path, as well as possibly some arbitrary state and a key.+ * The navigation action that produced a location.+ */+export type Action = "POP" | "PUSH" | "REPLACE";++/**+ * The default parsed `query` shape: repeated keys become arrays, matching+ * history@3's parser that the `location.query` readers were written against.+ */+export type DefaultQuery = Record<string, string | string[] | null | undefined>;++/**+ * The parsed query object carried on a `Location`. The generic is the concrete+ * shape a call site knows its query to have (e.g. `Location<{ tab?: string }>`).+ */+export type Query<T = DefaultQuery> = T;++/**+ * The `state` carried through a navigation. history@3 typed this `any` and the+ * legacy route-prop readers were written against that; tightened when the+ * `state.routing` slice is thinned to the pure v7 shape (DEV-2290).+ */+export type LocationState = any;++/**+ * An entry in a history stack. Mirrors history@3's `Location`: alongside the URL+ * parts it carries the parsed `query` object and the navigation `action` that+ * the legacy route-prop call sites still read. The generic is the shape of+ * `query`, not `state`. Thinned to the pure v7 shape (no `query`/`action`) when+ * the `state.routing` slice is retired (DEV-2290).** @see https://api.reactrouter.com/v7/interfaces/react-router.Location.html*/-export interface Location<State = unknown> {+export interface Location<Q = DefaultQuery> {pathname: string;search: string;hash: string;- state: State;+ query: Query<Q>;+ state: LocationState;+ action: Action;key: string;}+/**+ * The loose query accepted when building a navigation target, where values may+ * still be numbers or other primitives before serialization. Mirrors history@3's+ * `QueryLike`, distinct from the parsed `DefaultQuery` a `Location` carries.+ */+type QueryLike = Record<string, any>;++/**+ * A location to navigate to, as an object. Mirrors history@3's+ * `LocationDescriptorObject`; the string form is `LocationDescriptor`.+ */+export interface LocationDescriptorObject {+ pathname?: string;+ search?: string;+ query?: QueryLike;+ hash?: string;+ state?: LocationState;+}++/**+ * A location to navigate to: either a path string or a descriptor object.+ * Mirrors history@3's `LocationDescriptor`.+ */+export type LocationDescriptor = LocationDescriptorObject | string;++type LocationListener = (location: Location) => void;+type TransitionHook = (+ location: Location,+ callback: (result: unknown) => void,+) => unknown;++/**+ * The `history` object interface the facade still passes around (the middleware+ * driver, the sync bridge, and the route-leave tests). Mirrors history@3's+ * `History` so the v3 engine and the v7 navigator both satisfy it.+ */+export interface History<Q = DefaultQuery> {+ listenBefore(hook: TransitionHook): () => void;+ listen(listener: LocationListener): () => void;+ transitionTo(location: Location<Q>): void;+ push(path: LocationDescriptor): void;+ replace(path: LocationDescriptor): void;+ go(n: number): void;+ goBack(): void;+ goForward(): void;+ createKey(): string;+ createPath(path: LocationDescriptor): string;+ createHref(path: LocationDescriptor): string;+ createLocation(+ path?: LocationDescriptor,+ action?: Action,+ key?: string,+ ): Location<Q>;+ getCurrentLocation(): Location<Q>;+}+/*** Whether a relative `to` is resolved against the route hierarchy or against* the current URL path.diff --git a/frontend/src/metabase/router/use-location.ts b/frontend/src/metabase/router/use-location.tsindex 9c46083a1fa..367d81c7be3 100644--- a/frontend/src/metabase/router/use-location.ts+++ b/frontend/src/metabase/router/use-location.ts@@ -4,13 +4,14 @@ import type { Location } from "./types";import { useRouter } from "./use-router";/**- * react-router v7's `useLocation`, implemented over the v3 location injected- * into the router context (mirrored into redux `state.routing`). Returns the v7- * `Location` shape (no v3 `query` field).+ * react-router v7's `useLocation`, implemented over the location injected into+ * the router context (mirrored into redux `state.routing`). Returns the pure v7+ * `Location` shape (no v3 `query`/`action` fields); the legacy compat `Location`+ * type carries those for the route-prop call sites.** @see https://reactrouter.com/7.18.1/api/hooks/useLocation*/-export function useLocation(): Location {+export function useLocation(): Omit<Location, "query" | "action"> {const { location } = useRouter();return useMemo(diff --git a/frontend/src/metabase/router/v7/RouterBridge.tsx b/frontend/src/metabase/router/v7/RouterBridge.tsxindex 6bf7edbb621..fd37f8a3f0f 100644--- a/frontend/src/metabase/router/v7/RouterBridge.tsx+++ b/frontend/src/metabase/router/v7/RouterBridge.tsx@@ -1,4 +1,3 @@-import type { Location as HistoryLocation, LocationDescriptor } from "history";import { type ReactNode, useContext, useMemo, useRef } from "react";import {type NavigateOptions,@@ -20,6 +19,7 @@ import type {WithRouterProps,} from "../react-router";import type { Route } from "../route";+import type { Location as HistoryLocation, LocationDescriptor } from "../types";import { registerLeaveHook } from "./blocking-history";import { toV3Location } from "./location";diff --git a/frontend/src/metabase/router/v7/blocking-history.ts b/frontend/src/metabase/router/v7/blocking-history.tsindex 6027131c48b..1d28b2b032b 100644--- a/frontend/src/metabase/router/v7/blocking-history.ts+++ b/frontend/src/metabase/router/v7/blocking-history.ts@@ -1,4 +1,3 @@-import type { Location as HistoryLocation } from "history";import {type HistoryRouterProps,type To,@@ -6,6 +5,8 @@ import {parsePath,} from "react-router-v7";+import type { Location as HistoryLocation } from "../types";+import { toV3Location } from "./location";// react-router does not export the `History` interface directly, so pull it offdiff --git a/frontend/src/metabase/router/v7/blocking-history.unit.spec.ts b/frontend/src/metabase/router/v7/blocking-history.unit.spec.tsindex d735b5b3e7b..a14f70e02b0 100644--- a/frontend/src/metabase/router/v7/blocking-history.unit.spec.ts+++ b/frontend/src/metabase/router/v7/blocking-history.unit.spec.ts@@ -1,6 +1,7 @@-import type { Location as HistoryLocation } from "history";import { UNSAFE_createMemoryHistory as createMemoryHistory } from "react-router-v7";+import type { Location as HistoryLocation } from "../types";+import {hasLeaveHooks,registerLeaveHook,diff --git a/frontend/src/metabase/router/v7/location.ts b/frontend/src/metabase/router/v7/location.tsindex 838a48d1995..ec164ad9432 100644--- a/frontend/src/metabase/router/v7/location.ts+++ b/frontend/src/metabase/router/v7/location.ts@@ -1,6 +1,7 @@-import type { Location as HistoryLocation } from "history";import type { Location as V7Location } from "react-router-v7";+import type { Location as HistoryLocation } from "../types";+/*** Parse a search string into v3's `location.query` object: repeated keys become* an array, an empty value stays `""`, matching history@3's default parser thatdiff --git a/frontend/src/metabase/router/v7/navigator.ts b/frontend/src/metabase/router/v7/navigator.tsindex fb4d87e72fd..c3dbbf1e956 100644--- a/frontend/src/metabase/router/v7/navigator.ts+++ b/frontend/src/metabase/router/v7/navigator.ts@@ -1,7 +1,7 @@-import type { Location as HistoryLocation, LocationDescriptor } from "history";import type { NavigateFunction, NavigateOptions, To } from "react-router-v7";import type { RouterNavigator } from "../middleware";+import type { Location as HistoryLocation, LocationDescriptor } from "../types";import { queryToSearch } from "./location";diff --git a/frontend/src/metabase/router/v7/router-listen.unit.spec.tsx b/frontend/src/metabase/router/v7/router-listen.unit.spec.tsxindex f2c5db72c6d..db6b7e4f21a 100644--- a/frontend/src/metabase/router/v7/router-listen.unit.spec.tsx+++ b/frontend/src/metabase/router/v7/router-listen.unit.spec.tsx@@ -1,10 +1,10 @@-import type { Location as HistoryLocation } from "history";import { useEffect, useState } from "react";import { renderWithProviders, screen } from "__support__/ui";import { Outlet, Route, push, useRouter } from "metabase/router";import type { RouterEngine } from "../engine";+import type { Location as HistoryLocation } from "../types";// Both engines expose `listen` at runtime; v3's `InjectedRouter` type omits it.type RouterWithListen = {diff --git a/frontend/src/metabase/router/with-route-props.tsx b/frontend/src/metabase/router/with-route-props.tsxindex c22a21df175..f666dbcfc36 100644--- a/frontend/src/metabase/router/with-route-props.tsx+++ b/frontend/src/metabase/router/with-route-props.tsx@@ -1,10 +1,9 @@-import type { Location } from "history";import type { ComponentType } from "react";import { useRoute } from "./Outlet";import type { InjectedRouter, PlainRoute } from "./react-router";import type { Route } from "./route";-import type { Params } from "./types";+import type { Location, Params } from "./types";import { useRouter } from "./use-router";/**diff --git a/frontend/src/metabase/search/containers/SearchApp.tsx b/frontend/src/metabase/search/containers/SearchApp.tsxindex 3556565fa43..54de5c64ac7 100644--- a/frontend/src/metabase/search/containers/SearchApp.tsx+++ b/frontend/src/metabase/search/containers/SearchApp.tsx@@ -1,4 +1,3 @@-import type { LocationDescriptorObject } from "history";import { useCallback, useMemo } from "react";import { jt, t } from "ttag";import _ from "underscore";@@ -23,6 +22,7 @@ import type {} from "metabase/common/search/types";import { usePageTitle } from "metabase/hooks/use-page-title";import { useDispatch } from "metabase/redux";+import type { LocationDescriptorObject } from "metabase/router";import { push } from "metabase/router";import { SearchSidebar } from "metabase/search/components/SearchSidebar";import {diff --git a/frontend/src/metabase/selectors/app.ts b/frontend/src/metabase/selectors/app.tsindex 3bd72ca8a9a..a4d3aef1fb4 100644--- a/frontend/src/metabase/selectors/app.ts+++ b/frontend/src/metabase/selectors/app.ts@@ -1,8 +1,8 @@import type { Selector } from "@reduxjs/toolkit";import { createSelector } from "@reduxjs/toolkit";-import type { Location } from "history";import type { State } from "metabase/redux/store";+import type { Location } from "metabase/router";import {getEmbedOptions,getIsEmbeddingIframe,diff --git a/frontend/src/metabase/selectors/routing.ts b/frontend/src/metabase/selectors/routing.tsindex f56a1ad4266..ea590d6fd2d 100644--- a/frontend/src/metabase/selectors/routing.ts+++ b/frontend/src/metabase/selectors/routing.ts@@ -1,6 +1,5 @@-import type { Location } from "history";-import type { State } from "metabase/redux/store";+import type { Location } from "metabase/router";const DEFAULT_LOCATION: Location = {pathname: "",diff --git a/frontend/src/metabase/transforms/pages/JobRunListPage/JobRunListPage.tsx b/frontend/src/metabase/transforms/pages/JobRunListPage/JobRunListPage.tsxindex 98f3027eb57..b00b7c3eaad 100644--- a/frontend/src/metabase/transforms/pages/JobRunListPage/JobRunListPage.tsx+++ b/frontend/src/metabase/transforms/pages/JobRunListPage/JobRunListPage.tsx@@ -1,6 +1,5 @@import { useDisclosure, useElementSize } from "@mantine/hooks";import cx from "classnames";-import type { Location } from "history";import { useCallback, useLayoutEffect, useMemo, useState } from "react";import { t } from "ttag";@@ -13,6 +12,7 @@ import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrimport { PaginationControls } from "metabase/common/components/PaginationControls";import { usePageTitle } from "metabase/hooks/use-page-title";import { useDispatch } from "metabase/redux";+import type { Location } from "metabase/router";import { replace } from "metabase/router";import { POLLING_INTERVAL } from "metabase/transforms/constants";import { useJobHeaderState } from "metabase/transforms/hooks/use-job-header-state";diff --git a/frontend/src/metabase/transforms/pages/JobRunListPage/utils.ts b/frontend/src/metabase/transforms/pages/JobRunListPage/utils.tsindex bd209285d80..2b0e6c223ef 100644--- a/frontend/src/metabase/transforms/pages/JobRunListPage/utils.ts+++ b/frontend/src/metabase/transforms/pages/JobRunListPage/utils.ts@@ -1,5 +1,4 @@-import type { Location } from "history";-+import type { Location } from "metabase/router";import * as Urls from "metabase/urls";import {SORT_DIRECTIONS,diff --git a/frontend/src/metabase/transforms/pages/NewTransformPage/NewTransformPage.tsx b/frontend/src/metabase/transforms/pages/NewTransformPage/NewTransformPage.tsxindex a039fc702c8..67462c8b5f2 100644--- a/frontend/src/metabase/transforms/pages/NewTransformPage/NewTransformPage.tsx+++ b/frontend/src/metabase/transforms/pages/NewTransformPage/NewTransformPage.tsx@@ -1,5 +1,4 @@import { useDisclosure } from "@mantine/hooks";-import type { Location } from "history";import { useCallback, useMemo, useRef, useState } from "react";import { t } from "ttag";@@ -17,8 +16,7 @@ import {import { PLUGIN_REMOTE_SYNC, PLUGIN_TRANSFORMS_PYTHON } from "metabase/plugins";import { getInitialUiState } from "metabase/querying/editor/components/QueryEditor";import { useDispatch, useSelector } from "metabase/redux";-import { push } from "metabase/router";-import { Link, type Route } from "metabase/router";+import { Link, type Location, type Route, push } from "metabase/router";import { getMetadata } from "metabase/selectors/metadata";import { useRegisterMetabotTransformContext } from "metabase/transforms/hooks/use-register-transform-metabot-context";import { useTransformPermissions } from "metabase/transforms/hooks/use-transform-permissions";diff --git a/frontend/src/metabase/transforms/pages/RunListPage/RunListPage.tsx b/frontend/src/metabase/transforms/pages/RunListPage/RunListPage.tsxindex 100e8ca7ac2..ff8335f69f5 100644--- a/frontend/src/metabase/transforms/pages/RunListPage/RunListPage.tsx+++ b/frontend/src/metabase/transforms/pages/RunListPage/RunListPage.tsx@@ -1,6 +1,5 @@import { useDisclosure, useElementSize } from "@mantine/hooks";import cx from "classnames";-import type { Location } from "history";import { useCallback, useLayoutEffect, useMemo, useState } from "react";import { t } from "ttag";@@ -14,6 +13,7 @@ import { DataStudioBreadcrumbs } from "metabase/common/data-studio/components/Daimport { PaneHeader } from "metabase/common/data-studio/components/PaneHeader";import { useSetting } from "metabase/common/hooks";import { useDispatch } from "metabase/redux";+import type { Location } from "metabase/router";import { replace } from "metabase/router";import { DetailedViewSwitch } from "metabase/transforms/components/DetailedViewSwitch";import { LockedTransformsBanner } from "metabase/transforms/components/LockedTransformsBanner/LockedTransformsBanner";diff --git a/frontend/src/metabase/transforms/pages/RunListPage/utils.ts b/frontend/src/metabase/transforms/pages/RunListPage/utils.tsindex 52a5bc31f4f..7104cd70406 100644--- a/frontend/src/metabase/transforms/pages/RunListPage/utils.ts+++ b/frontend/src/metabase/transforms/pages/RunListPage/utils.ts@@ -1,5 +1,4 @@-import type { Location } from "history";-+import type { Location } from "metabase/router";import * as Urls from "metabase/urls";import {SORT_DIRECTIONS,diff --git a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsPopover.tsx b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsPopover.tsxindex c8a26454bd7..f95f3de3352 100644--- a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsPopover.tsx+++ b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsPopover.tsx@@ -1,8 +1,8 @@-import type { LocationDescriptorObject } from "history";import { Component } from "react";import { connect } from "metabase/redux";import type { Dispatch } from "metabase/redux/store";+import type { LocationDescriptorObject } from "metabase/router";import { PopoverWithRef } from "metabase/ui/components/overlays/Popover/PopoverWithRef";import { getEventTarget } from "metabase/utils/dom";import { performAction } from "metabase/visualizations/lib/action";diff --git a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsxindex 06a67006954..bc7cb6ed864 100644--- a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx+++ b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx@@ -1,6 +1,5 @@/* eslint-disable complexity */import cx from "classnames";-import type { LocationDescriptorObject } from "history";import React, {type CSSProperties,type ComponentType,@@ -25,6 +24,7 @@ import { connect } from "metabase/redux";import { getIsDownloadingToImage } from "metabase/redux/downloads";import type { Dispatch, State } from "metabase/redux/store";import { CardEmbedLoadingState } from "metabase/rich_text_editing/tiptap/extensions/CardEmbed/CardEmbedLoadingState";+import type { LocationDescriptorObject } from "metabase/router";import { getTokenFeature } from "metabase/selectors/settings";import { getFont } from "metabase/styled-components/selectors";import type { IconProps } from "metabase/ui";diff --git a/frontend/src/metabase/visualizations/lib/action.ts b/frontend/src/metabase/visualizations/lib/action.tsindex e4485df5699..eedeacd15bd 100644--- a/frontend/src/metabase/visualizations/lib/action.ts+++ b/frontend/src/metabase/visualizations/lib/action.ts@@ -1,7 +1,7 @@-import type { LocationDescriptorObject } from "history";import _ from "underscore";import type { Dispatch } from "metabase/redux/store";+import type { LocationDescriptorObject } from "metabase/router";import { push } from "metabase/router";import type Question from "metabase-lib/v1/Question";diff --git a/frontend/src/metabase/visualizations/lib/open-url.ts b/frontend/src/metabase/visualizations/lib/open-url.tsindex 555c29a4fa2..32e20927f69 100644--- a/frontend/src/metabase/visualizations/lib/open-url.ts+++ b/frontend/src/metabase/visualizations/lib/open-url.ts@@ -1,9 +1,11 @@import querystring from "querystring";-import type { LocationDescriptor, LocationDescriptorObject } from "history";-import { handleLinkSdkPlugin } from "embedding-sdk-shared/lib/sdk-global-plugins";import { isEmbeddingSdk } from "metabase/embedding-sdk/config";+import type {+ LocationDescriptor,+ LocationDescriptorObject,+} from "metabase/router";import {clickLink,getPathnameWithoutSubPath,