From 7d7742a7faf69e787a326ff172fa07dc477fc61a Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 14 Jan 2026 00:44:15 -0500 Subject: [PATCH] feature/IO-3499-React-19: Remove redundant forward refs in favor of React 19 built in ref prop --- .../bill-line-search-select.component.jsx | 5 ++- .../contract-status-select.component.jsx | 6 ++-- .../courtesy-car-fuel-select.component.jsx | 5 ++- ...ourtesy-car-readiness-select.component.jsx | 6 ++-- .../courtesy-car-status-select.component.jsx | 6 ++-- .../employee-team-search-select.component.jsx | 6 ++-- ...form-input-number-calculator.component.jsx | 4 +-- .../currency-form-item.component.jsx | 5 ++- .../email-form-item.component.jsx | 6 ++-- .../labor-type-form-item.component.jsx | 3 +- .../part-type-form-item.component.jsx | 3 +- .../phone-form-item.component.jsx | 5 ++- .../job-search-select.component.jsx | 17 +++++---- .../notification-center.component.jsx | 35 ++++++++----------- .../owner-search-select.component.jsx | 6 ++-- .../trello-board/components/ListComponent.jsx | 6 ++-- .../task-center/task-center.component.jsx | 19 +++++++--- .../vehicle-search-select.component.jsx | 6 ++-- .../vendor-search-select.component.jsx | 6 ++-- 19 files changed, 77 insertions(+), 78 deletions(-) diff --git a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx index 63404a49c..c4afa697c 100644 --- a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx +++ b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx @@ -1,9 +1,8 @@ import { Select } from "antd"; -import { forwardRef } from "react"; import { useTranslation } from "react-i18next"; import InstanceRenderMgr from "../../utils/instanceRenderMgr"; -const BillLineSearchSelect = ({ options, disabled, allowRemoved, ...restProps }, ref) => { +const BillLineSearchSelect = ({ options, disabled, allowRemoved, ref, ...restProps }) => { const { t } = useTranslation(); return ( @@ -68,4 +67,4 @@ function generateLineName(item) { ); } -export default forwardRef(BillLineSearchSelect); +export default BillLineSearchSelect; diff --git a/client/src/components/contract-status-select/contract-status-select.component.jsx b/client/src/components/contract-status-select/contract-status-select.component.jsx index 69d38656a..a02664f6c 100644 --- a/client/src/components/contract-status-select/contract-status-select.component.jsx +++ b/client/src/components/contract-status-select/contract-status-select.component.jsx @@ -1,10 +1,10 @@ -import { forwardRef, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { Select } from "antd"; import { useTranslation } from "react-i18next"; const { Option } = Select; -const ContractStatusComponent = forwardRef(({ value, onChange }, ref) => { +const ContractStatusComponent = ({ value, onChange, ref }) => { const [option, setOption] = useState(value); const { t } = useTranslation(); @@ -21,7 +21,7 @@ const ContractStatusComponent = forwardRef(({ value, onChange }, ref) => { ); -}); +}; ContractStatusComponent.displayName = "ContractStatusComponent"; diff --git a/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx b/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx index a189e0660..ddfaa0845 100644 --- a/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx +++ b/client/src/components/courtesy-car-fuel-select/courtesy-car-fuel-select.component.jsx @@ -1,8 +1,7 @@ import { Slider } from "antd"; -import { forwardRef } from "react"; import { useTranslation } from "react-i18next"; -const CourtesyCarFuelComponent = (props, ref) => { +const CourtesyCarFuelComponent = ({ ref, ...props }) => { const { t } = useTranslation(); const marks = { @@ -63,4 +62,4 @@ const CourtesyCarFuelComponent = (props, ref) => { /> ); }; -export default forwardRef(CourtesyCarFuelComponent); +export default CourtesyCarFuelComponent; diff --git a/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx b/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx index c6ff8212d..eea8819d8 100644 --- a/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx +++ b/client/src/components/courtesy-car-readiness-select/courtesy-car-readiness-select.component.jsx @@ -1,10 +1,10 @@ import { Select } from "antd"; -import { forwardRef, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; const { Option } = Select; -const CourtesyCarReadinessComponent = ({ value, onChange }, ref) => { +const CourtesyCarReadinessComponent = ({ value, onChange, ref }) => { const [option, setOption] = useState(value); const { t } = useTranslation(); @@ -29,4 +29,4 @@ const CourtesyCarReadinessComponent = ({ value, onChange }, ref) => { ); }; -export default forwardRef(CourtesyCarReadinessComponent); +export default CourtesyCarReadinessComponent; diff --git a/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx b/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx index 11dd09296..31f0216de 100644 --- a/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx +++ b/client/src/components/courtesy-car-status-select/courtesy-car-status-select.component.jsx @@ -1,10 +1,10 @@ -import { forwardRef, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { Select } from "antd"; import { useTranslation } from "react-i18next"; const { Option } = Select; -const CourtesyCarStatusComponent = ({ value, onChange }, ref) => { +const CourtesyCarStatusComponent = ({ value, onChange, ref }) => { const [option, setOption] = useState(value); const { t } = useTranslation(); @@ -32,4 +32,4 @@ const CourtesyCarStatusComponent = ({ value, onChange }, ref) => { ); }; -export default forwardRef(CourtesyCarStatusComponent); +export default CourtesyCarStatusComponent; diff --git a/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx b/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx index 3005b0534..ad83ae557 100644 --- a/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx +++ b/client/src/components/employee-team-search-select/employee-team-search-select.component.jsx @@ -1,17 +1,17 @@ import { useQuery } from "@apollo/client/react"; import { Select } from "antd"; -import { forwardRef } from "react"; import { QUERY_TEAMS } from "../../graphql/employee_teams.queries"; import AlertComponent from "../alert/alert.component"; //To be used as a form element only. -const EmployeeTeamSearchSelect = ({ ...props }) => { +const EmployeeTeamSearchSelect = ({ ref, ...props }) => { const { loading, error, data } = useQuery(QUERY_TEAMS); if (error) return ; return ( ; } -export default forwardRef(FormItemPhone); +export default FormItemPhone; export const PhoneItemFormatterValidation = () => ({ async validator(rule, value) { diff --git a/client/src/components/job-search-select/job-search-select.component.jsx b/client/src/components/job-search-select/job-search-select.component.jsx index f70beb627..62d1f60f3 100644 --- a/client/src/components/job-search-select/job-search-select.component.jsx +++ b/client/src/components/job-search-select/job-search-select.component.jsx @@ -2,7 +2,7 @@ import { LoadingOutlined } from "@ant-design/icons"; import { useLazyQuery } from "@apollo/client/react"; import { Select, Space, Spin, Tag } from "antd"; import _ from "lodash"; -import { forwardRef, useEffect, useMemo, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE, SEARCH_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries"; import AlertComponent from "../alert/alert.component"; @@ -10,10 +10,15 @@ import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-displ const { Option } = Select; -const JobSearchSelect = ( - { disabled, convertedOnly = false, notInvoiced = false, notExported = true, clm_no = false, ...restProps }, - ref -) => { +const JobSearchSelect = ({ + disabled, + convertedOnly = false, + notInvoiced = false, + notExported = true, + clm_no = false, + ref, + ...restProps +}) => { const { t } = useTranslation(); const [theOptions, setTheOptions] = useState([]); @@ -107,4 +112,4 @@ const JobSearchSelect = ( ); }; -export default forwardRef(JobSearchSelect); +export default JobSearchSelect; diff --git a/client/src/components/notification-center/notification-center.component.jsx b/client/src/components/notification-center/notification-center.component.jsx index 67fb7119d..0702447c7 100644 --- a/client/src/components/notification-center/notification-center.component.jsx +++ b/client/src/components/notification-center/notification-center.component.jsx @@ -5,31 +5,27 @@ import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import "./notification-center.styles.scss"; import day from "../../utils/day.js"; -import { forwardRef, useEffect, useRef } from "react"; +import { useEffect, useRef } from "react"; import { DateTimeFormat } from "../../utils/DateFormatter.jsx"; const { Text, Title } = Typography; /** * Notification Center Component - * @type {React.ForwardRefExoticComponent & React.RefAttributes>} */ -const NotificationCenterComponent = forwardRef( - ( - { - visible, - notifications, - loading, - showUnreadOnly, - toggleUnreadOnly, - markAllRead, - loadMore, - onNotificationClick, - unreadCount, - isEmployee - }, - ref - ) => { +const NotificationCenterComponent = ({ + visible, + notifications, + loading, + showUnreadOnly, + toggleUnreadOnly, + markAllRead, + loadMore, + onNotificationClick, + unreadCount, + isEmployee, + ref +}) => { const { t } = useTranslation(); const navigate = useNavigate(); const virtuosoRef = useRef(null); @@ -127,8 +123,7 @@ const NotificationCenterComponent = forwardRef( )} ); - } -); +}; NotificationCenterComponent.displayName = "NotificationCenterComponent"; diff --git a/client/src/components/owner-search-select/owner-search-select.component.jsx b/client/src/components/owner-search-select/owner-search-select.component.jsx index 6107ae764..d065f1db9 100644 --- a/client/src/components/owner-search-select/owner-search-select.component.jsx +++ b/client/src/components/owner-search-select/owner-search-select.component.jsx @@ -2,14 +2,14 @@ import { LoadingOutlined } from "@ant-design/icons"; import { useLazyQuery } from "@apollo/client/react"; import { Empty, Select } from "antd"; import _ from "lodash"; -import { forwardRef, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { SEARCH_OWNERS_BY_ID_FOR_AUTOCOMPLETE, SEARCH_OWNERS_FOR_AUTOCOMPLETE } from "../../graphql/owners.queries"; import AlertComponent from "../alert/alert.component"; import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; const { Option } = Select; -const OwnerSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { +const OwnerSearchSelect = ({ value, onChange, onBlur, disabled, ref }) => { const [callSearch, { loading, error, data }] = useLazyQuery(SEARCH_OWNERS_FOR_AUTOCOMPLETE); const [callIdSearch, { loading: idLoading, error: idError, data: idData }] = useLazyQuery( @@ -85,4 +85,4 @@ const OwnerSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { ); }; -export default forwardRef(OwnerSearchSelect); +export default OwnerSearchSelect; diff --git a/client/src/components/production-board-kanban/trello-board/components/ListComponent.jsx b/client/src/components/production-board-kanban/trello-board/components/ListComponent.jsx index 9d6da60d9..3abb90f70 100644 --- a/client/src/components/production-board-kanban/trello-board/components/ListComponent.jsx +++ b/client/src/components/production-board-kanban/trello-board/components/ListComponent.jsx @@ -1,10 +1,8 @@ -import { forwardRef } from "react"; - -const ListComponent = forwardRef(({ style, children, ...props }, ref) => ( +const ListComponent = ({ style, children, ref, ...props }) => (
{children}
-)); +); ListComponent.displayName = "ListComponent"; diff --git a/client/src/components/task-center/task-center.component.jsx b/client/src/components/task-center/task-center.component.jsx index 8b269f7b7..459e495fc 100644 --- a/client/src/components/task-center/task-center.component.jsx +++ b/client/src/components/task-center/task-center.component.jsx @@ -1,7 +1,7 @@ import { Virtuoso } from "react-virtuoso"; import { Badge, Button, Spin } from "antd"; import { useTranslation } from "react-i18next"; -import { forwardRef, useMemo, useRef } from "react"; +import { useMemo, useRef } from "react"; import day from "../../utils/day.js"; import "./task-center.styles.scss"; import { @@ -12,8 +12,18 @@ import { QuestionCircleOutlined } from "@ant-design/icons"; -const TaskCenterComponent = forwardRef( - ({ visible, tasks, loading, error, onTaskClick, onLoadMore, hasMore, createNewTask, incompleteTaskCount }, ref) => { +const TaskCenterComponent = ({ + visible, + tasks, + loading, + error, + onTaskClick, + onLoadMore, + hasMore, + createNewTask, + incompleteTaskCount, + ref +}) => { const { t } = useTranslation(); const virtuosoRef = useRef(null); @@ -149,8 +159,7 @@ const TaskCenterComponent = forwardRef( )} ); - } -); +}; TaskCenterComponent.displayName = "TaskCenterComponent"; export default TaskCenterComponent; diff --git a/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx b/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx index 698ad3807..f06db3124 100644 --- a/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx +++ b/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx @@ -2,7 +2,7 @@ import { LoadingOutlined } from "@ant-design/icons"; import { useLazyQuery } from "@apollo/client/react"; import { Empty, Select } from "antd"; import _ from "lodash"; -import { forwardRef, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import { SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE, SEARCH_VEHICLES_FOR_AUTOCOMPLETE @@ -11,7 +11,7 @@ import AlertComponent from "../alert/alert.component"; const { Option } = Select; -const VehicleSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { +const VehicleSearchSelect = ({ value, onChange, onBlur, disabled, ref }) => { const [callSearch, { loading, error, data }] = useLazyQuery(SEARCH_VEHICLES_FOR_AUTOCOMPLETE); const [callIdSearch, { loading: idLoading, error: idError, data: idData }] = useLazyQuery( @@ -87,4 +87,4 @@ const VehicleSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { ); }; -export default forwardRef(VehicleSearchSelect); +export default VehicleSearchSelect; diff --git a/client/src/components/vendor-search-select/vendor-search-select.component.jsx b/client/src/components/vendor-search-select/vendor-search-select.component.jsx index cc366b7cd..a8c0d5a24 100644 --- a/client/src/components/vendor-search-select/vendor-search-select.component.jsx +++ b/client/src/components/vendor-search-select/vendor-search-select.component.jsx @@ -1,13 +1,13 @@ import { HeartOutlined } from "@ant-design/icons"; import { Select, Space, Tag } from "antd"; -import { forwardRef, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; const { Option } = Select; // To be used as a form element only. -const VendorSearchSelect = ({ value, onChange, options, onSelect, disabled, preferredMake, showPhone }, ref) => { +const VendorSearchSelect = ({ value, onChange, options, onSelect, disabled, preferredMake, showPhone, ref }) => { const [option, setOption] = useState(value); useEffect(() => { @@ -131,4 +131,4 @@ const VendorSearchSelect = ({ value, onChange, options, onSelect, disabled, pref ); }; -export default forwardRef(VendorSearchSelect); +export default VendorSearchSelect;