Refactored the code.

This commit is contained in:
Owaise Imdad committed 2025-03-05 09:21:08 +05:30
1 parent a7a8bb2ea8
commit 3376186ff3
2 files changed
+3 -4

No files matched your search

+2 -3
View File
@@ -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;