feat(analogInputs): auto-load chart data when table row is selected

- Added useEffect to AnalogInputsChart to automatically trigger "Daten laden" when a row is selected and selectedAnalogInput.id is not 0.
- Improves UX by syncing table selection with chart data fetch, no manual
This commit is contained in:
ISA
2025-07-22 15:09:47 +02:00
parent d44fe916da
commit 5a0188c635
6 changed files with 22 additions and 5 deletions

View File

@@ -157,6 +157,14 @@ export default function AnalogInputsChart() {
);
};
// Auto-trigger fetch when a row is selected and id is not 0 (only once per selection)
React.useEffect(() => {
if (selectedAnalogInput?.id && selectedAnalogInput.id !== 0) {
handleFetchData();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedAnalogInput?.id]);
// ✅ Chart-Daten aus Redux filtern (Chart reagiert nur nach Button)
const chartKey = selectedAnalogInput?.id
? String(selectedAnalogInput.id + 99)