Files
haproxy-openmanager/frontend/src
taylanbakircioglu a1a2206098 Fix: Race condition in FrontendManagement - Guard clauses added
CRITICAL RACE CONDITION FIX - FrontendManagement:
Same race condition pattern found and fixed

Component Analysis:
  BackendServers: FIXED (guard clause added)
  FrontendManagement: FIXED (guard clause added)
  SSLManagement: Already has guard clause
  WAFManagement: Already has guard clause

FrontendManagement Issues Fixed:
1. fetchFrontends() - Added guard clause
   if (!selectedCluster) → Clear state and return

2. fetchBackends() - Added guard clause
   if (!selectedCluster) → Clear state and return

Race Condition Pattern:
  Mount → selectedCluster=undefined → fetch() → API returns ALL
  Load → selectedCluster=1 → fetch() → API returns filtered
  Problem: First response arrives late and overwrites correct data

Solution - Guard Clauses:
  if (!selectedCluster) {
    setEntities([]);
    setFilteredEntities([]);
    return; // Don't call API
  }

Risk Assessment - SAFE:
  - Only adds early return if no cluster selected
  - Doesn't change existing logic when cluster IS selected
  - Same pattern already used in SSLManagement and WAFManagement
  - No breaking changes to other functions

Impact:
  - Prevents race condition on component mount
  - Prevents all entities appearing briefly
  - Consistent behavior across all management pages

Tested Components:
  Backend/Frontend/SSL/WAF Management all now protected
2025-11-07 11:51:15 +03:00
..
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00
2025-10-27 12:14:03 +03:00