refactor: lade OPC UA Daten direkt in NetworkInfo-Komponente statt global in _app.tsx

- Thunk `fetchOpcUaSettingsThunk` wird jetzt nur bei Anzeige von NetworkInfo ausgeführt
- Reduzierte Netzwerklast und bessere Trennung von Zuständigkeiten
- Entfernt globalen OPC UA-Aufruf aus _app.tsx
This commit is contained in:
ISA
2025-03-26 10:45:00 +01:00
parent 0bbc2a25a6
commit 7b85ebc730
9 changed files with 59 additions and 100 deletions

View File

@@ -1,9 +1,16 @@
"use client"; //components/main/uebersicht/NetworkInfo.tsx
import React from "react";
import { useSelector } from "react-redux";
import { RootState } from "../../../redux/store";
import React, { useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
import { RootState, AppDispatch } from "../../../redux/store";
import { fetchOpcUaSettingsThunk } from "../../../redux/thunks/fetchOpcUaSettingsThunk";
const NetworkInfo: React.FC = () => {
const dispatch: AppDispatch = useDispatch();
// ✅ OPC UA Daten laden, wenn Komponente angezeigt wird
useEffect(() => {
dispatch(fetchOpcUaSettingsThunk());
}, [dispatch]);
// Werte direkt aus Redux holen
const ip =
useSelector((state: RootState) => state.systemSettings.ip) || "Unbekannt";