From 54e23bfc760da61c5afbadb96dbfc2bb83a88f02 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 14 Sep 2025 22:16:52 +0200 Subject: [PATCH] =?UTF-8?q?Stabilis=C3=A9r=20t=C3=B8mrer=20og=20materiale?= =?UTF-8?q?=20tabs=20med=20proper=20state=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Tilføj explicit data loading når tabs aktiveres - Implementer loading og error states for bedre UX - Clear state ved view skift for at undgå stale data - Disable form inputs under loading - Tilføj fallback beskeder for tomme kategorier - Ensartet struktur med andre stabile tabs som OpenAI budget --- frontend/src/App.js | 48 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.js b/frontend/src/App.js index 58b2396..e0efa04 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -546,10 +546,16 @@ function App() { React.useEffect(() => { if (selectedCategory) { if (currentView === 'labor-prices') { + setLaborPrices([]); // Clear existing data loadLaborPrices(selectedCategory); } else if (currentView === 'material-prices') { + setMaterialPrices([]); // Clear existing data loadMaterialPrices(selectedCategory); } + } else { + // Clear data when no category selected + setLaborPrices([]); + setMaterialPrices([]); } }, [selectedCategory, currentView]); @@ -698,13 +704,25 @@ function App() { @@ -965,12 +983,25 @@ function App() {

👷 Tømrer Priser

Se tidligere arbejdspriser og tilføj nye timelønssatser for forskellige projekttyper.

+ {error && ( +
+ {error} +
+ )} + + {loading && ( +
+ Indlæser data... +
+ )} +
setSelectedCategory(e.target.value)} + disabled={loading} > {categories.materialCategories && categories.materialCategories.map(cat => (