fix:kein doppelte Chart Effekt in einem Modal

This commit is contained in:
ISA
2025-02-14 10:41:53 +01:00
parent c1a2f6e311
commit d0c5c1c341
2 changed files with 3 additions and 9 deletions

View File

@@ -14,19 +14,13 @@ const LoopChartActionBar: React.FC = () => {
const response = await fetch("/mockData.json");
const data = await response.json();
if (Array.isArray(data)) {
// data ist ein Array und kann mit .map() verwendet werden
console.log("Daten geladen:", data);
dispatch(setChartData(data));
} else {
console.error("Erwartetes Array, aber erhalten:", data);
}
dispatch(setChartData(data));
setShowChart(true);
} catch (error) {
console.error("Fehler beim Laden der Daten:", error);
if (error instanceof Response) {
const errorMessage = await error.text();
console.error("Fehlermeldung vom Server:", errorMessage);
}
}
};
@@ -39,7 +33,7 @@ const LoopChartActionBar: React.FC = () => {
>
Aktualisieren
</button>
{showChart && <LoopMeasurementChart />}
{showChart && null}
</div>
);
};