Refactor GroupControls and Products components to improve API call conditions and remove commented-out code
This commit is contained in:
@@ -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(() => {
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user