From baca60e7424edaed2e51a94eb4bc5c789db2f0c4 Mon Sep 17 00:00:00 2001 From: gatici Date: Thu, 9 Jan 2025 16:56:45 +0300 Subject: [PATCH] chore: remove useEffect as modals are closed using mutate handlers Signed-off-by: gatici --- app/(nms)/network-configuration/page.tsx | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/app/(nms)/network-configuration/page.tsx b/app/(nms)/network-configuration/page.tsx index b7e87e5..65361f2 100644 --- a/app/(nms)/network-configuration/page.tsx +++ b/app/(nms)/network-configuration/page.tsx @@ -1,5 +1,5 @@ "use client"; -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import { Button, Card, @@ -24,7 +24,6 @@ const NetworkConfiguration = () => { const [isCreateModalVisible, setCreateModalVisible] = useState(false); const [isEditModalVisible, setEditModalVisible] = useState(false); const [networkSlice, setNetworkSlice] = useState(undefined); - const [refresh, setRefresh] = useState(false); const auth = useAuth() const { data: networkSlices = [], isLoading: loading, status: networkSlicesQueryStatus, error: networkSlicesQueryError } = useQuery({ @@ -52,18 +51,6 @@ const NetworkConfiguration = () => { }, }); - // Trigger UI refresh when refresh flag is set - useEffect(() => { - if (refresh) { - // Reset refresh state - setRefresh(false); - // Close modal after adding network slice - setCreateModalVisible(false); - // Close modal after editing network slice - setEditModalVisible(false); - } - }, [refresh, setCreateModalVisible, setEditModalVisible]); - const handleAddNetworkSlice = (newSlice: NetworkSlice) => { addNetworkSliceMutation.mutate(newSlice, { onSuccess: () => { @@ -153,7 +140,7 @@ const NetworkConfiguration = () => { confirmationModalProps={{ title: "Warning", confirmButtonLabel: "Delete", - buttonRow: (null), + buttonRow: null, onConfirm: () => { }, children: (