RANGER-4610: API calls for zones and services on initial landing in ZoneListing page is being called twice
Signed-off-by: Mehul Parikh <mehul@apache.org>
diff --git a/security-admin/src/main/webapp/react-webapp/src/views/SecurityZone/ZoneListing.jsx b/security-admin/src/main/webapp/react-webapp/src/views/SecurityZone/ZoneListing.jsx
index e9c7ec8..f01483b 100644
--- a/security-admin/src/main/webapp/react-webapp/src/views/SecurityZone/ZoneListing.jsx
+++ b/security-admin/src/main/webapp/react-webapp/src/views/SecurityZone/ZoneListing.jsx
@@ -50,8 +50,11 @@
this.fetchData();
}
- componentDidUpdate(prevState) {
- if (this.props.params.zoneId != prevState.params.zoneId) {
+ componentDidUpdate(prevProps) {
+ if (
+ prevProps?.params?.zoneId !== undefined &&
+ this.props.params.zoneId != prevProps.params.zoneId
+ ) {
this.fetchData();
}
}