Skip to content

Commit 923452f

Browse files
committed
refactor: simplify CloudVersionSelect component by removing unused refs and effects
- Removed the labelRef and associated useEffect from CloudVersionSelect to streamline the component. - Updated the rendering logic to directly display the currentCloudVersion.label, enhancing clarity and maintainability.
1 parent fadc986 commit 923452f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/components/Layout/VersionSelect/CloudVersionSelect.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ export default function CloudVersionSelect(props: VersionSelectProps) {
131131
const [open, setOpen] = React.useState<boolean>(false);
132132
const handleClick = () => setOpen(true);
133133
const handleClose = () => setOpen(false);
134-
const labelRef = useRef<HTMLSpanElement>(null);
134+
// const labelRef = useRef<HTMLSpanElement>(null);
135135

136-
useEffect(() => {
137-
if (labelRef.current && currentCloudVersion.label) {
138-
labelRef.current.textContent = currentCloudVersion.label as string;
139-
}
140-
}, [currentCloudVersion]);
136+
// useEffect(() => {
137+
// if (labelRef.current && currentCloudVersion.label) {
138+
// labelRef.current.textContent = currentCloudVersion.label as string;
139+
// }
140+
// }, [currentCloudVersion]);
141141

142142
return (
143143
<>
@@ -151,7 +151,7 @@ export default function CloudVersionSelect(props: VersionSelectProps) {
151151
lineHeight: "1.25rem",
152152
}}
153153
>
154-
<span id={CLOUD_PLAN_LABEL_ELEMENT_ID} ref={labelRef}></span>
154+
{currentCloudVersion.label}
155155
</Typography>
156156
{currentCloudVersion?.icon}
157157
</Box>

0 commit comments

Comments
 (0)