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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user