From 386595ae9b4253ea526bf7dfd9edbfe0c7472a17 Mon Sep 17 00:00:00 2001 From: ISA Date: Tue, 5 Nov 2024 10:12:24 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20Aktualisierung=20der=20Modal-Eingabewer?= =?UTF-8?q?te=20angepasst,=20um=20automatisches=20Zur=C3=BCcksetzen=20zu?= =?UTF-8?q?=20verhindern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Die Werte aus Redux werden nun nur beim Öffnen des Modals in die lokalen State-Variablen übernommen. - Während der Bearbeitung bleibt der Zustand der Eingabefelder stabil, ohne alle 10 Sekunden zurückgesetzt zu werden. - Dies ermöglicht eine bequemere Bearbeitung, ohne dass Änderungen automatisch überschrieben werden. --- components/modales/SettingsModal.jsx | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/components/modales/SettingsModal.jsx b/components/modales/SettingsModal.jsx index c10680b..04ac0f2 100644 --- a/components/modales/SettingsModal.jsx +++ b/components/modales/SettingsModal.jsx @@ -172,6 +172,7 @@ function SettingModal({ showModal, onClose }) { }); }; //--------------------------------------------------- + // Setze initiale Werte nur beim Öffnen des Modals useEffect(() => { if (showModal) { setName(deviceName_Redux || ""); @@ -187,22 +188,8 @@ function SettingModal({ showModal, onClose }) { setNtpTimezone(ntpTimezone_Redux || ""); setActive(active_Redux || ""); } - }, [ - showModal, - deviceName_Redux, - mac1_Redux, - mac2_Redux, - ip_Redux, - subnet_Redux, - gateway_Redux, - datetime_Redux, - ntp1_Redux, - ntp2_Redux, - ntp3_Redux, - ntpTimezone_Redux, - active_Redux, - ]); - //--------------------------------------------------- + }, [showModal]); // Nur beim Öffnen des Modals erneut setzen + useEffect(() => { setOriginalValues({ name: deviceName_Redux, @@ -226,7 +213,6 @@ function SettingModal({ showModal, onClose }) { ntpTimezone_Redux, active_Redux, ]); - //--------------------------------------------------- return ( <>