Pushed global thresholds inside create if branch

This commit is contained in:
singh-kanwarpreet committed 2025-07-30 19:38:23 +05:30
1 parent 0ecbf48f5d
commit 5e46a9f2d5
1 file changed
+4 -4
@@ -93,6 +93,10 @@ const CreateInfrastructureMonitor = () => {
// Populate form fields if editing // Populate form fields if editing
useEffect(() => { useEffect(() => {
if (isCreate) {
// If global settings are not loaded yet, use default thresholds
if (globalSettingsLoading) return;
// Create mode: use global thresholds
const globalThresholds = globalSettings?.data?.settings?.globalThresholds; const globalThresholds = globalSettings?.data?.settings?.globalThresholds;
const defaultThresholds = { const defaultThresholds = {
cpu: "", cpu: "",
@@ -101,10 +105,6 @@ const CreateInfrastructureMonitor = () => {
temperature: "", temperature: "",
}; };
if (isCreate) {
// If global settings are not loaded yet, use default thresholds
if (globalSettingsLoading) return;
// Create mode: use global thresholds
setInfrastructureMonitor((prev) => ({ setInfrastructureMonitor((prev) => ({
...prev, ...prev,
url: "", url: "",