Refactor GroupControls and Products components to improve API call conditions and remove commented-out code

This commit is contained in:
2025-10-14 11:06:29 +05:30
parent 48faaac1fe
commit 04d5f51920
2 changed files with 7 additions and 7 deletions

View File

@@ -28,11 +28,11 @@ function GroupControls() {
useEffect(() => { useEffect(() => {
if (!projectId || !selectedVersion) return; if (!projectId || !selectedVersion) return;
getAssetGroupsApi(projectId, selectedVersion.versionId).then((data) => { // getAssetGroupsApi(projectId, selectedVersion.versionId).then((data) => {
if (data && data.length > 0) { // if (data && data.length > 0) {
setGroups(data); // setGroups(data);
} // }
}); // });
}, [projectId, selectedVersion]); }, [projectId, selectedVersion]);
useEffect(() => { useEffect(() => {

View File

@@ -40,7 +40,7 @@ function Products() {
}, [comparisonScene, layout]); }, [comparisonScene, layout]);
useEffect(() => { useEffect(() => {
if (!selectedVersion || !simulationSocket || selectedProduct.productUuid !== "" || !projectId) return; if (!selectedVersion || !simulationSocket || !projectId) return;
getAllProductsApi(projectId || "", selectedVersion.versionId) getAllProductsApi(projectId || "", selectedVersion.versionId)
.then((data) => { .then((data) => {
if (data && data.length === 0) { if (data && data.length === 0) {
@@ -112,7 +112,7 @@ function Products() {
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
}); });
}, [selectedVersion?.versionId, simulationSocket, selectedProduct, projectId, userId, organization]); }, [selectedVersion?.versionId, simulationSocket, projectId, userId, organization]);
useEffect(() => { useEffect(() => {
if (selectedProduct.productUuid) { if (selectedProduct.productUuid) {