From 3376186ff34ddf533c87763a480eb53ed33a8b86 Mon Sep 17 00:00:00 2001 From: Owaise Imdad Date: Wed, 5 Mar 2025 09:21:08 +0530 Subject: [PATCH] Refactored the code. --- src/Components/Inputs/Select/index.jsx | 5 ++--- src/Utils/truncateUtils.jsx | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Components/Inputs/Select/index.jsx b/src/Components/Inputs/Select/index.jsx index ec5f2d012..a3d0a5608 100644 --- a/src/Components/Inputs/Select/index.jsx +++ b/src/Components/Inputs/Select/index.jsx @@ -55,8 +55,8 @@ const Select = ({ truncate = false, maxStringLength = 10, }) => { - const [maxLength, setMaxLength] = useState(0); // Initially set maxLength to 0 - const selectRef = useRef(null); // Reference for the Select container + const [maxLength, setMaxLength] = useState(0); + const selectRef = useRef(null); const theme = useTheme(); const itemStyles = { @@ -85,7 +85,6 @@ const Select = ({ }; }, [maxStringLength, truncate]); - // Get the selected item's name const selectedItemName = truncate ? items.find((item) => item._id === value)?.name // Only calculate if truncate is true : null; diff --git a/src/Utils/truncateUtils.jsx b/src/Utils/truncateUtils.jsx index 2474bae4f..579b71622 100644 --- a/src/Utils/truncateUtils.jsx +++ b/src/Utils/truncateUtils.jsx @@ -1,5 +1,5 @@ // src/utils/truncateUtils.js -import { isEmpty } from "./stringUtils"; // assuming you have the stringUtils file +import { isEmpty } from "./stringUtils"; /** * Utility function to render a truncated value with an optional title.