+ );
+ })}
diff --git a/frontend/src/components/DashboardV2.js b/frontend/src/components/DashboardV2.js
index 8aca262..18f073b 100644
--- a/frontend/src/components/DashboardV2.js
+++ b/frontend/src/components/DashboardV2.js
@@ -399,6 +399,13 @@ const DashboardV2 = () => {
useEffect(() => {
if (!selectedCluster) return;
+ // CRITICAL FIX: Clear all dashboard state when cluster changes
+ setStatsData({});
+ setFrontendOptions([]);
+ setBackendOptions([]);
+ setBackendHealth([]);
+ setSlowestBackends([]);
+
let isMounted = true;
const loadInitialData = async () => {
diff --git a/frontend/src/components/FrontendManagement.js b/frontend/src/components/FrontendManagement.js
index 8436e51..81e7194 100644
--- a/frontend/src/components/FrontendManagement.js
+++ b/frontend/src/components/FrontendManagement.js
@@ -147,6 +147,15 @@ const FrontendManagement = () => {
};
useEffect(() => {
+ // CRITICAL FIX: Clear state when cluster changes to prevent showing other cluster's data
+ // Race condition: Old cluster data remains visible while new cluster data is fetching
+ if (selectedCluster) {
+ setFrontends([]);
+ setFilteredFrontends([]);
+ setBackends([]);
+ setSslCertificates([]);
+ }
+
fetchFrontends();
fetchBackends();
fetchSSLCertificates();
diff --git a/frontend/src/components/WAFManagement.js b/frontend/src/components/WAFManagement.js
index 78cc354..addc85d 100644
--- a/frontend/src/components/WAFManagement.js
+++ b/frontend/src/components/WAFManagement.js
@@ -274,6 +274,13 @@ const WAFManagement = () => {
};
useEffect(() => {
+ // CRITICAL FIX: Clear state when cluster changes to prevent showing other cluster's data
+ if (selectedCluster) {
+ setRules([]);
+ setFilteredRules([]);
+ setFrontends([]);
+ }
+
fetchRules();
fetchStats();
checkPendingChanges();