Add selectedVersion checks in multiple components to prevent API calls without a valid version
This commit is contained in:
@@ -72,6 +72,7 @@ const ZoneGroup: React.FC = () => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedVersion) return;
|
||||
getZonesApi(organization, projectId, selectedVersion?.versionId || '').then((data) => {
|
||||
if (data && data.length > 0) {
|
||||
const fetchedZones = data.map((zone: any) => ({
|
||||
@@ -90,10 +91,10 @@ const ZoneGroup: React.FC = () => {
|
||||
);
|
||||
|
||||
setZonePoints(fetchedPoints);
|
||||
}else{
|
||||
} else {
|
||||
setZones([]);
|
||||
}
|
||||
}).catch((err)=>{
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
})
|
||||
}, [selectedVersion?.versionId]);
|
||||
|
||||
Reference in New Issue
Block a user