diff --git a/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx b/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx index 452aa59762e747dd6048439b9c7265b4c9660515..87f7cd1be289dd55c9b2373a2d1b57293b2d26b3 100644 --- a/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx +++ b/frontend/src/metabase/admin/datamodel/hoc/FilteredToUrlTable.jsx @@ -10,6 +10,9 @@ import Icon from "metabase/components/Icon"; import FieldSet from "metabase/components/FieldSet"; import { DatabaseSchemaAndTableDataSelector } from "metabase/query_builder/components/DataSelector"; +/** + * @deprecated HOCs are deprecated + */ const FilteredToUrlTable = propName => ComposedComponent => connect(null, { push })( class FilteredToUrlTable extends React.Component { diff --git a/frontend/src/metabase/admin/datamodel/hoc/withTableMetadataLoaded.js b/frontend/src/metabase/admin/datamodel/hoc/withTableMetadataLoaded.js index 1121e7e67ecc2d41e895346ef9afa54b48130b89..cab0c0b40ea3fcf1eaa80dbb11afbb09bcab4229 100644 --- a/frontend/src/metabase/admin/datamodel/hoc/withTableMetadataLoaded.js +++ b/frontend/src/metabase/admin/datamodel/hoc/withTableMetadataLoaded.js @@ -2,6 +2,9 @@ import React, { Component } from "react"; import { PLUGIN_FEATURE_LEVEL_PERMISSIONS } from "metabase/plugins"; +/** + * @deprecated HOCs are deprecated + */ export default ComposedComponent => { class TableMetadataLoader extends Component { componentDidMount() { diff --git a/frontend/src/metabase/components/BodyComponent/BodyComponent.jsx b/frontend/src/metabase/components/BodyComponent/BodyComponent.jsx index 1dc50f5ec76fe6d45c61e96828875dc822e33a42..8926a60e7c2e4ac809b73304912f2cae22318815 100644 --- a/frontend/src/metabase/components/BodyComponent/BodyComponent.jsx +++ b/frontend/src/metabase/components/BodyComponent/BodyComponent.jsx @@ -2,6 +2,9 @@ import React, { Component } from "react"; import ReactDOM from "react-dom"; +/** + * @deprecated HOCs are deprecated + */ export default ComposedComponent => class extends Component { static displayName = diff --git a/frontend/src/metabase/components/ExplicitSize.jsx b/frontend/src/metabase/components/ExplicitSize.jsx index 1c4ae1a297fae4e069502f2051d29e831ff2916f..a679de90d6362f62edebacba96b57cb201a60766 100644 --- a/frontend/src/metabase/components/ExplicitSize.jsx +++ b/frontend/src/metabase/components/ExplicitSize.jsx @@ -16,6 +16,9 @@ const REFRESH_MODE = { none: fn => fn, }; +/** + * @deprecated HOCs are deprecated + */ export default ({ selector, wrapped, refreshMode = "throttle" } = {}) => ComposedComponent => { const displayName = ComposedComponent.displayName || ComposedComponent.name; diff --git a/frontend/src/metabase/components/ModalWithTrigger/ModalWithTrigger.jsx b/frontend/src/metabase/components/ModalWithTrigger/ModalWithTrigger.jsx index 272aec191c2016dd6b6737ef49266e701bda6de7..5dbb0d03c168e95bbdba2895b3353549eb902f9d 100644 --- a/frontend/src/metabase/components/ModalWithTrigger/ModalWithTrigger.jsx +++ b/frontend/src/metabase/components/ModalWithTrigger/ModalWithTrigger.jsx @@ -1,4 +1,7 @@ import Triggerable from "metabase/components/Triggerable"; import Modal from "metabase/components/Modal"; +/** + * @deprecated use Modal + useState + */ export default Triggerable(Modal); diff --git a/frontend/src/metabase/components/PopoverWithTrigger/PopoverWithTrigger.jsx b/frontend/src/metabase/components/PopoverWithTrigger/PopoverWithTrigger.jsx index c50b7d891b8a4e6fbd839d2af78a83681829884f..1eda806eeb277cc0e43ed658b675d2e4021562d0 100644 --- a/frontend/src/metabase/components/PopoverWithTrigger/PopoverWithTrigger.jsx +++ b/frontend/src/metabase/components/PopoverWithTrigger/PopoverWithTrigger.jsx @@ -1,4 +1,7 @@ import Triggerable from "metabase/components/Triggerable"; import Popover from "metabase/components/Popover"; +/** + * @deprecated use Popover + useState + */ export default Triggerable(Popover); diff --git a/frontend/src/metabase/components/Triggerable/Triggerable.jsx b/frontend/src/metabase/components/Triggerable/Triggerable.jsx index 7f934c75d011eda306bf2b92fb4090e67dff42a3..5055a946a72627c31a0827da08186a3d45df4f78 100644 --- a/frontend/src/metabase/components/Triggerable/Triggerable.jsx +++ b/frontend/src/metabase/components/Triggerable/Triggerable.jsx @@ -9,9 +9,12 @@ import Tooltip from "metabase/core/components/Tooltip"; const Trigger = styled.a``; -// higher order component that takes a component which takes props "isOpen" and optionally "onClose" -// and returns a component that renders a <a> element "trigger", and tracks whether that component is open or not - +/** + * higher order component that takes a component which takes props "isOpen" and optionally "onClose" + * and returns a component that renders a <a> element "trigger", and tracks whether that component is open or not + * + * @deprecated HOCs are deprecated - use Modal + useState + */ const Triggerable = ComposedComponent => class extends Component { static displayName = diff --git a/frontend/src/metabase/components/__mocks__/ExplicitSize.jsx b/frontend/src/metabase/components/__mocks__/ExplicitSize.jsx index 71a7892fc26bf0320b56b28dd9a2204200a5d206..900e5ee802aec26cec47f80aa87b3709a32db65f 100644 --- a/frontend/src/metabase/components/__mocks__/ExplicitSize.jsx +++ b/frontend/src/metabase/components/__mocks__/ExplicitSize.jsx @@ -1,6 +1,9 @@ /* eslint-disable react/display-name */ import React from "react"; +/** + * @deprecated HOCs are deprecated + */ const ExplicitSize = measureClass => ComposedComponent => props => <ComposedComponent width={1000} height={1000} {...props} />; diff --git a/frontend/src/metabase/dashboard/components/ClickMappings.jsx b/frontend/src/metabase/dashboard/components/ClickMappings.jsx index 6fbad9ab509e3041a6efa42927c49734a62692ff..353450ac8ef240c398f1b181a3ee44fa0414d682 100644 --- a/frontend/src/metabase/dashboard/components/ClickMappings.jsx +++ b/frontend/src/metabase/dashboard/components/ClickMappings.jsx @@ -265,7 +265,11 @@ function TargetWithSource({ ); } -// TODO: Extract this to a more general HOC. It can probably also take care of withTableMetadataLoaded. +/** + * TODO: Extract this to a more general HOC. It can probably also take care of withTableMetadataLoaded. + * + * @deprecated HOCs are deprecated + */ function loadQuestionMetadata(getQuestion) { return ComposedComponent => { class MetadataLoader extends React.Component { diff --git a/frontend/src/metabase/dashboard/hoc/DashboardControls.jsx b/frontend/src/metabase/dashboard/hoc/DashboardControls.jsx index 9f8354fa16e6e9d8ac72743e8bd006acc65a09ac..3ec44712efed340bcb2f455a02e6fea9e10af27f 100644 --- a/frontend/src/metabase/dashboard/hoc/DashboardControls.jsx +++ b/frontend/src/metabase/dashboard/hoc/DashboardControls.jsx @@ -12,6 +12,8 @@ const TICK_PERIOD = 1; // seconds /* This contains some state for dashboard controls on both private and embedded dashboards. * It should probably be in Redux? + * + * @deprecated HOCs are deprecated */ export default ComposedComponent => connect(null, { replace })( diff --git a/frontend/src/metabase/dashboard/hoc/DashboardData.jsx b/frontend/src/metabase/dashboard/hoc/DashboardData.jsx index 99907a884ddfdbf0cb7a295ff8a5069fc802e384..f4443c1b3287e2f9ef43c66307b99c6443d0102e 100644 --- a/frontend/src/metabase/dashboard/hoc/DashboardData.jsx +++ b/frontend/src/metabase/dashboard/hoc/DashboardData.jsx @@ -36,6 +36,9 @@ const mapDispatchToProps = { onChangeLocation: push, }; +/** + * @deprecated HOCs are deprecated + */ export default ComposedComponent => connect( mapStateToProps, diff --git a/frontend/src/metabase/dashboard/hoc/WithVizSettingsData.js b/frontend/src/metabase/dashboard/hoc/WithVizSettingsData.js index 64edefa938f2f0b6b7c4d4d90938db089eb190b0..f2460fbd9c856d9e866b9d43f0a111269cc8fc39 100644 --- a/frontend/src/metabase/dashboard/hoc/WithVizSettingsData.js +++ b/frontend/src/metabase/dashboard/hoc/WithVizSettingsData.js @@ -7,7 +7,10 @@ import _ from "underscore"; import { getUserAttributes } from "metabase/selectors/user"; import { getLinkTargets } from "metabase/lib/click-behavior"; -// This HOC give access to data referenced in viz settings. +/** + * This HOC gives access to data referenced in viz settings. + * @deprecated HOCs are deprecated + */ const WithVizSettingsData = ComposedComponent => { return withRouter( connect( diff --git a/frontend/src/metabase/entities/containers/EntityListLoader.jsx b/frontend/src/metabase/entities/containers/EntityListLoader.jsx index 9a935794d26e14283c40d961a0be0358844351e0..c6ae9e64df79c16f72f2d297415970445cb39adb 100644 --- a/frontend/src/metabase/entities/containers/EntityListLoader.jsx +++ b/frontend/src/metabase/entities/containers/EntityListLoader.jsx @@ -295,6 +295,9 @@ EntityListLoader.defaultProps = defaultProps; export default EntityListLoader; +/** + * @deprecated HOCs are deprecated + */ export const entityListLoader = ellProps => ComposedComponent => { function WrappedComponent(props) { return ( diff --git a/frontend/src/metabase/entities/containers/EntityObjectLoader.jsx b/frontend/src/metabase/entities/containers/EntityObjectLoader.jsx index 3fbfdc4dade5dd3b208359f1d0b8c12cdb00c430..21e7003a8244fcc90fc12b58beda7f681a4ffa91 100644 --- a/frontend/src/metabase/entities/containers/EntityObjectLoader.jsx +++ b/frontend/src/metabase/entities/containers/EntityObjectLoader.jsx @@ -184,6 +184,9 @@ const EntityObjectLoader = _.compose( export default EntityObjectLoader; +/** + * @deprecated HOCs are deprecated + */ export const entityObjectLoader = eolProps => // eslint-disable-line react/display-name diff --git a/frontend/src/metabase/entities/containers/EntityType.jsx b/frontend/src/metabase/entities/containers/EntityType.jsx index 0d1553558fe9ecd856a7513e4766700e473eb219..8c0f65181061825a9a2a260e30207db839fe16e8 100644 --- a/frontend/src/metabase/entities/containers/EntityType.jsx +++ b/frontend/src/metabase/entities/containers/EntityType.jsx @@ -3,6 +3,9 @@ import React from "react"; import { connect } from "react-redux"; import { bindActionCreators } from "@reduxjs/toolkit"; +/** + * @deprecated HOCs are deprecated + */ export default () => ComposedComponent => { const mapStateToProps = (state, props) => ({ entityDef: diff --git a/frontend/src/metabase/hoc/AutoExpanding.jsx b/frontend/src/metabase/hoc/AutoExpanding.jsx index be71a065986aa6a19055f96f8b7df5527fafbbcf..715a437a57139072bd09e58028036abf31e37668 100644 --- a/frontend/src/metabase/hoc/AutoExpanding.jsx +++ b/frontend/src/metabase/hoc/AutoExpanding.jsx @@ -3,11 +3,15 @@ import React from "react"; import ExplicitSize from "metabase/components/ExplicitSize"; -// If the composed element increases from it's original width, sets `expand` to true -// -// Used for components which we initially want to be small, but if they expand -// beyond their initial size we want to fix their size to be larger so it doesn't -// jump around, etc +/** + * If the composed element increases from it's original width, sets `expand` to true + * + * Used for components which we initially want to be small, but if they expand + * beyond their initial size we want to fix their size to be larger so it doesn't + * jump around, etc + * + * @deprecated HOCs are deprecated + */ export default ComposedComponent => ExplicitSize()( class AutoExpanding extends React.Component { diff --git a/frontend/src/metabase/hoc/Background.jsx b/frontend/src/metabase/hoc/Background.jsx index 6cc596d59a7c484022efad819e40a48defd2ad55..9fd25c2cdf37af65e714a5f48c40a17ffe8aca34 100644 --- a/frontend/src/metabase/hoc/Background.jsx +++ b/frontend/src/metabase/hoc/Background.jsx @@ -1,6 +1,9 @@ /* eslint-disable react/prop-types */ import React, { Component } from "react"; +/** + * @deprecated HOCs are deprecated + */ export const withBackground = className => ComposedComponent => { return class extends Component { static displayName = "BackgroundApplicator"; diff --git a/frontend/src/metabase/hoc/Favicon.jsx b/frontend/src/metabase/hoc/Favicon.jsx index 472d70e197e1201c9883d101e10875409c15ef07..a5d7bce47f76caea79682c593b84c4796af3b30b 100644 --- a/frontend/src/metabase/hoc/Favicon.jsx +++ b/frontend/src/metabase/hoc/Favicon.jsx @@ -17,6 +17,9 @@ const resolveFavicon = (setterOrGetter, props) => { } }; +/** + * @deprecated HOCs are deprecated + */ const withFavicon = faviconSetterOrGetter => ComposedComponent => { const WithFavicon = props => { const favicon = resolveFavicon(faviconSetterOrGetter, props); diff --git a/frontend/src/metabase/hoc/FitViewPort.jsx b/frontend/src/metabase/hoc/FitViewPort.jsx index ff7b2bfebcc5c807412b50dc489ba93aea578d4a..b1dec3c0628f3fa794b0c8754573a78f33657cf5 100644 --- a/frontend/src/metabase/hoc/FitViewPort.jsx +++ b/frontend/src/metabase/hoc/FitViewPort.jsx @@ -1,6 +1,7 @@ import React from "react"; -/* fitViewport allows you to modify the top level classes on the react root node +/** + * fitViewport allows you to modify the top level classes on the react root node * to set certain display properties that make it easier to create a view that will always * be the size of the viewport height. * @@ -15,8 +16,8 @@ import React from "react"; * * On an element that isn't the top level of a route. * + * @deprecated HOCs are deprecated */ - function fitViewport(ComposedComponent) { return class extends React.Component { static displayName = "FitViewport"; diff --git a/frontend/src/metabase/hoc/ListSelect.jsx b/frontend/src/metabase/hoc/ListSelect.jsx index 20bd1944caac20583f7ac1ef537f14e9fbb97bf0..51f85d02415f9f3ffec134b744fdf34c53269bb8 100644 --- a/frontend/src/metabase/hoc/ListSelect.jsx +++ b/frontend/src/metabase/hoc/ListSelect.jsx @@ -5,13 +5,17 @@ import _ from "underscore"; const DEFAULT_KEY_FOR_ITEM = item => item.id; -// Higher order component for managing selection of a list. -// -// Expects component to be provided a `list` prop (or prop named by `listProp`) -// Injects `selected` and `deselected` arrays, a `selection` set, and various -// methods to select or deselect individual or all items -// -// Composes with EntityListLoader, ListSearch, etc +/** + * Higher order component for managing selection of a list. + * + * Expects component to be provided a `list` prop (or prop named by `listProp`) + * Injects `selected` and `deselected` arrays, a `selection` set, and various + * methods to select or deselect individual or all items + * + * Composes with EntityListLoader, ListSearch, etc + * + * @deprecated HOCs are deprecated + */ const listSelect = ({ listProp = "list", keyForItem = DEFAULT_KEY_FOR_ITEM } = {}) => ComposedComponent => diff --git a/frontend/src/metabase/hoc/PaginationState.jsx b/frontend/src/metabase/hoc/PaginationState.jsx index 9a94fc86ec7e0f0cfd734adb9619759e002cf9da..c70aac5a4063233b782145db2932fbaf93545fab 100644 --- a/frontend/src/metabase/hoc/PaginationState.jsx +++ b/frontend/src/metabase/hoc/PaginationState.jsx @@ -1,6 +1,9 @@ /* eslint-disable react/prop-types */ import React from "react"; +/** + * @deprecated HOCs are deprecated + */ const paginationState = () => ComposedComponent => class extends React.Component { constructor(props) { diff --git a/frontend/src/metabase/hoc/Remapped.jsx b/frontend/src/metabase/hoc/Remapped.jsx index 64e2ee1ca4e9bb9f9f0a52f8e5de9ef52bbca83f..d435d6bd0ddcd12da1d31fd40430d039556ff061 100644 --- a/frontend/src/metabase/hoc/Remapped.jsx +++ b/frontend/src/metabase/hoc/Remapped.jsx @@ -13,6 +13,9 @@ const mapDispatchToProps = { fetchRemapping, }; +/** + * @deprecated HOCs are deprecated + */ export default ComposedComponent => connect( mapStateToProps, diff --git a/frontend/src/metabase/hoc/RenderPropToHOC.jsx b/frontend/src/metabase/hoc/RenderPropToHOC.jsx index 017ed01d61c24a81f83a74ca56c75649208b4bf0..41d7b4399c0a2036a9f1d7bdffd77f68e59f75b6 100644 --- a/frontend/src/metabase/hoc/RenderPropToHOC.jsx +++ b/frontend/src/metabase/hoc/RenderPropToHOC.jsx @@ -1,5 +1,8 @@ import React from "react"; +/** + * @deprecated HOCs are deprecated + */ export default function renderPropToHoc(RenderPropComponent) { // eslint-disable-next-line react/display-name return ComposedComponent => props => diff --git a/frontend/src/metabase/hoc/Routeless.jsx b/frontend/src/metabase/hoc/Routeless.jsx index bdba50ae9a225f8a14942370e3720228b5fd9b22..7355101d6c0d359c073742f2ac0612c08dab25fd 100644 --- a/frontend/src/metabase/hoc/Routeless.jsx +++ b/frontend/src/metabase/hoc/Routeless.jsx @@ -16,8 +16,12 @@ const mapDispatchToProps = { _routeless_goBack: goBack, }; -// this higher order component wraps any component (typically a fullscreen modal) with an "onClose" -// prop, injects an entry in the browser history, and closes the component if the back button is pressed +/** + * this higher order component wraps any component (typically a fullscreen modal) with an "onClose" + * prop, injects an entry in the browser history, and closes the component if the back button is pressed + * + * @deprecated HOCs are deprecated + */ export default ( ComposedComponent, // clone the state object otherwise the state will be replaced rather than pushed diff --git a/frontend/src/metabase/hoc/Title.jsx b/frontend/src/metabase/hoc/Title.jsx index 85e3ebf6311f4e66a389321f8fd288c1e334f44a..697e962447d26c26962fb4a1074337909bb569a0 100644 --- a/frontend/src/metabase/hoc/Title.jsx +++ b/frontend/src/metabase/hoc/Title.jsx @@ -15,6 +15,9 @@ const updateDocumentTitle = _.debounce(() => { .join(SEPARATOR); }); +/** + * @deprecated HOCs are deprecated + */ const title = documentTitleOrGetter => ComposedComponent => class extends React.Component { static displayName = diff --git a/frontend/src/metabase/hoc/TitleWithLoadingTime.jsx b/frontend/src/metabase/hoc/TitleWithLoadingTime.jsx index 2ab05aec903ac815c6070178db008a6ef0a31b6b..d164634d44fe5f42a9ac36cbc955a63185bb7603 100644 --- a/frontend/src/metabase/hoc/TitleWithLoadingTime.jsx +++ b/frontend/src/metabase/hoc/TitleWithLoadingTime.jsx @@ -5,6 +5,9 @@ import title from "metabase/hoc/Title"; const SECONDS_UNTIL_DISPLAY = 10; +/** + * @deprecated HOCs are deprecated + */ export default startTimePropName => ComposedComponent => title(({ [startTimePropName]: startTime, isRunning }) => { if (startTime == null || !isRunning) { diff --git a/frontend/src/metabase/hoc/Toast.jsx b/frontend/src/metabase/hoc/Toast.jsx index d28f6d58e76c5b8cf52544c4c615b09e17ecd56a..d506dcf5bb3b2f383cfd69ea0c4dd34cad5e1570 100644 --- a/frontend/src/metabase/hoc/Toast.jsx +++ b/frontend/src/metabase/hoc/Toast.jsx @@ -8,6 +8,9 @@ const mapDispatchToProps = { addUndo, }; +/** + * @deprecated HOCs are deprecated + */ const withToaster = ComposedComponent => { class ToastedComponent extends React.Component { _triggerToast = (message, options = {}) => { diff --git a/frontend/src/metabase/hoc/Typeahead.jsx b/frontend/src/metabase/hoc/Typeahead.jsx index b7990c777e1fa41569b0c35e4c2e390bdfa63d3b..5f629faeacdf4eb33e82cf21a70758f21e1483ce 100644 --- a/frontend/src/metabase/hoc/Typeahead.jsx +++ b/frontend/src/metabase/hoc/Typeahead.jsx @@ -16,6 +16,9 @@ const DEFAULT_FILTER_OPTIONS = (value, option) => { const DEFAULT_OPTION_IS_EQUAL = (a, b) => a === b; +/** + * @deprecated HOCs are deprecated + */ export default ({ optionFilter = DEFAULT_FILTER_OPTIONS, optionIsEqual = DEFAULT_OPTION_IS_EQUAL, diff --git a/frontend/src/metabase/hoc/__mocks__/Remapped.jsx b/frontend/src/metabase/hoc/__mocks__/Remapped.jsx index b9e0111936007b244b0dc1905b5d136f9f1b4167..286a52d70ae9584b6d1540a1501d2f021beb2845 100644 --- a/frontend/src/metabase/hoc/__mocks__/Remapped.jsx +++ b/frontend/src/metabase/hoc/__mocks__/Remapped.jsx @@ -1,3 +1,6 @@ +/** + * @deprecated HOCs are deprecated + */ const MockRemapped = ComposedComponent => ComposedComponent; export default MockRemapped; diff --git a/frontend/src/metabase/visualizations/components/ChartSettings.jsx b/frontend/src/metabase/visualizations/components/ChartSettings.jsx index 54085be65dee0af3ade2f4ee394f24c42fd0202c..d10d502fd575e59cdd5e7c8d7ccaa080dca5d1ce 100644 --- a/frontend/src/metabase/visualizations/components/ChartSettings.jsx +++ b/frontend/src/metabase/visualizations/components/ChartSettings.jsx @@ -44,6 +44,9 @@ import { // section names are localized const DEFAULT_TAB_PRIORITY = [t`Data`]; +/** + * @deprecated HOCs are deprecated + */ const withTransientSettingState = ComposedComponent => class extends React.Component { static displayName = `withTransientSettingState[${ diff --git a/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.jsx b/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.jsx index dcc96aa2c286e69b8a2b0466310adf60fe158e29..df17db2a585e8edc0537f7ead439221525c12af0 100644 --- a/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.jsx +++ b/frontend/src/metabase/visualizations/components/settings/ChartSettingNestedSettings.jsx @@ -6,6 +6,9 @@ import _ from "underscore"; import { updateSettings } from "metabase/visualizations/lib/settings"; import ChartSettingsWidget from "../ChartSettingsWidget"; +/** + * @deprecated HOCs are deprecated + */ const chartSettingNestedSettings = ({ getObjectKey, getSettingsWidgetsForObject }) => ComposedComponent =>