Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Dissolve the hoc module into its four consumers (#82547)

Romeo Van Snick9f00ac4fc009
diff --git a/frontend/lint/module-boundaries.mjs b/frontend/lint/module-boundaries.mjs
index 82093405095..aefea1a41bf 100644
--- a/frontend/lint/module-boundaries.mjs
+++ b/frontend/lint/module-boundaries.mjs
@@ -224,7 +224,6 @@ const elements = [
pattern: "frontend/src/embedding-sdk-shared/**",
}),
createElement({ type: "shared", name: "forms" }),
- createElement({ type: "shared", name: "hoc" }),
createElement({ type: "feature", name: "home" }),
createElement({ type: "shared", name: "hooks" }),
createElement({ type: "shared", name: "content-translation" }),
@@ -400,6 +399,8 @@ const elements = [
// Entry point for the static-viz bundle (server-side chart rendering in
// GraalJS) - like app.tsx, it composes OSS + EE code for a build artifact.
// Full-mode entries match before folder patterns, whatever the order.
+ "frontend/src/metabase/ScrollToTop.tsx",
+ "frontend/src/metabase/ScrollToTop.unit.spec.tsx",
"frontend/src/metabase/static-viz/index.tsx",
"frontend/src/metabase/static-viz/index.unit.spec.tsx",
].map((path) =>
diff --git a/frontend/lint/shared-tiers.mjs b/frontend/lint/shared-tiers.mjs
index fdf23574762..7450c95f611 100644
--- a/frontend/lint/shared-tiers.mjs
+++ b/frontend/lint/shared-tiers.mjs
@@ -39,7 +39,6 @@ const SHARED_UTILS_LEVELS = [
// U6 — composition over the levels below.
// The store factory composes reducers, plugin middlewares, and the router.
[
- "shared/hoc",
"shared/upsells",
"shared/route-guards",
"shared/redux-store",
diff --git a/frontend/src/metabase/AppComponent.tsx b/frontend/src/metabase/AppComponent.tsx
index 29ccf359d4c..cc05c2e28f5 100644
--- a/frontend/src/metabase/AppComponent.tsx
+++ b/frontend/src/metabase/AppComponent.tsx
@@ -22,7 +22,6 @@ import {
import { UndoListing } from "metabase/common/components/UndoListing";
import { ContentViewportContext } from "metabase/common/context/ContentViewportContext";
import CS from "metabase/css/core/index.css";
-import ScrollToTop from "metabase/hoc/ScrollToTop";
import { usePageTitle } from "metabase/hooks/use-page-title";
import { useDispatch, useSelector } from "metabase/redux";
import { setErrorPage } from "metabase/redux/app";
@@ -37,6 +36,7 @@ import { initializeIframeResizer } from "metabase/utils/dom";
import { AppContainer, AppContent, AppContentContainer } from "./App.styled";
import { AppKBarProvider } from "./AppKBarProvider";
import ErrorBoundary from "./ErrorBoundary";
+import ScrollToTop from "./ScrollToTop";
import { trackPageView } from "./analytics";
import { Metabot } from "./metabot/components/Metabot";
import { NewModals } from "./new/components/NewModals/NewModals";
diff --git a/frontend/src/metabase/hoc/ScrollToTop.tsx b/frontend/src/metabase/ScrollToTop.tsx
similarity index 100%
rename from frontend/src/metabase/hoc/ScrollToTop.tsx
rename to frontend/src/metabase/ScrollToTop.tsx
diff --git a/frontend/src/metabase/hoc/ScrollToTop.unit.spec.tsx b/frontend/src/metabase/ScrollToTop.unit.spec.tsx
similarity index 100%
rename from frontend/src/metabase/hoc/ScrollToTop.unit.spec.tsx
rename to frontend/src/metabase/ScrollToTop.unit.spec.tsx
diff --git a/frontend/src/metabase/hoc/Remapped.tsx b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/Value/Remapped.tsx
similarity index 100%
rename from frontend/src/metabase/hoc/Remapped.tsx
rename to frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/Value/Remapped.tsx
diff --git a/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/Value/RemappedValue.tsx b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/Value/RemappedValue.tsx
index 1da073ac7de..99c6bf661c5 100644
--- a/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/Value/RemappedValue.tsx
+++ b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/Value/RemappedValue.tsx
@@ -2,13 +2,14 @@ import type { ReactNode } from "react";
import { useTranslateContent } from "metabase/content-translation/hooks";
import CS from "metabase/css/core/index.css";
-import AutoLoadRemapped from "metabase/hoc/Remapped";
import { getRemappedFieldValue } from "metabase/metadata-store";
import { useSelector } from "metabase/redux";
import { formatValue } from "metabase/value-formatting";
import type { ParameterField } from "metabase-lib/v1/parameters/types";
import { isID } from "metabase-lib/v1/types/utils/isa";
+import AutoLoadRemapped from "./Remapped";
+
type RenderNormal = (opts: {
value?: unknown;
column?: ParameterField;
diff --git a/frontend/src/metabase/questions/components/QuestionLoader.tsx b/frontend/src/metabase/questions/components/QuestionLoader.tsx
index 8fa99746fb3..1e083d912b4 100644
--- a/frontend/src/metabase/questions/components/QuestionLoader.tsx
+++ b/frontend/src/metabase/questions/components/QuestionLoader.tsx
@@ -1,12 +1,13 @@
import type { ReactNode } from "react";
import { serializeCardForUrl } from "metabase/common/utils/card";
-import renderPropToHOC from "metabase/hoc/RenderPropToHOC";
import { AdHocQuestionLoader } from "metabase/questions/components/AdHocQuestionLoader";
import { SavedQuestionLoader } from "metabase/questions/components/SavedQuestionLoader";
import type Question from "metabase-lib/v1/Question";
import type { CardId, UnsavedCard } from "metabase-types/api";
+import renderPropToHOC from "./RenderPropToHOC";
+
export type QuestionLoaderChildrenProps = {
question: Question | null;
loading: boolean;
diff --git a/frontend/src/metabase/hoc/RenderPropToHOC.tsx b/frontend/src/metabase/questions/components/RenderPropToHOC.tsx
similarity index 100%
rename from frontend/src/metabase/hoc/RenderPropToHOC.tsx
rename to frontend/src/metabase/questions/components/RenderPropToHOC.tsx
diff --git a/frontend/src/metabase/hoc/MantineTheme.tsx b/frontend/src/metabase/visualizations/components/TableInteractive/MantineTheme.tsx
similarity index 100%
rename from frontend/src/metabase/hoc/MantineTheme.tsx
rename to frontend/src/metabase/visualizations/components/TableInteractive/MantineTheme.tsx
diff --git a/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx b/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx
index dc0c3250bea..c17efd1ad5b 100644
--- a/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx
+++ b/frontend/src/metabase/visualizations/components/TableInteractive/TableInteractive.tsx
@@ -42,7 +42,6 @@ import type {
PlainCellFormatter,
RowIdColumnOptions,
} from "metabase/data-grid/types";
-import { withMantineTheme } from "metabase/hoc/MantineTheme";
import { useDispatch } from "metabase/redux";
import { setUIControls } from "metabase/redux/query-builder";
import { Flex, type MantineTheme } from "metabase/ui";
@@ -77,6 +76,7 @@ import {
getHighlightedTableCells,
} from "../../visualizations/Table/get-highlighted-table-cells";
+import { withMantineTheme } from "./MantineTheme";
import S from "./TableInteractive.module.css";
import { TableInteractiveContextProvider } from "./TableInteractiveContext";
import {