Add selectedVersion checks in multiple components to prevent API calls without a valid version

This commit is contained in:
2025-06-23 10:09:09 +05:30
parent 1ac0e86e74
commit 5d0c36071e
7 changed files with 12 additions and 4 deletions

View File

@@ -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]);