From fbb4530d7ac980f9b9b54757813c023089f600f8 Mon Sep 17 00:00:00 2001
From: Ariel Costas Guerrero <ariel@costas.dev>
Date: Sun, 7 Dec 2025 20:17:30 +0100
Subject: Fix stutter caused by the "setDataLoading" changes. I'm a moron.

---
 src/frontend/app/routes/stops-$id.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src/frontend/app/routes/stops-$id.tsx')

diff --git a/src/frontend/app/routes/stops-$id.tsx b/src/frontend/app/routes/stops-$id.tsx
index c674e22..31cc75f 100644
--- a/src/frontend/app/routes/stops-$id.tsx
+++ b/src/frontend/app/routes/stops-$id.tsx
@@ -126,7 +126,6 @@ export default function Estimates() {
 
   const loadData = useCallback(async () => {
     try {
-      setDataLoading(true);
       setDataError(null);
 
       const body = await loadConsolidatedData(params.id!);
@@ -142,8 +141,6 @@ export default function Estimates() {
       setDataError(parseError(error));
       setData(null);
       setDataDate(null);
-    } finally {
-      setDataLoading(false);
     }
   }, [params.id, stopIdNum]);
 
@@ -153,10 +150,12 @@ export default function Estimates() {
 
   const handleManualRefresh = useCallback(async () => {
     try {
+      setDataLoading(true);
       setIsManualRefreshing(true);
       await refreshData();
     } finally {
       setIsManualRefreshing(false);
+      setDataLoading(false);
     }
   }, [refreshData]);
 
@@ -168,12 +167,14 @@ export default function Estimates() {
 
   useEffect(() => {
     // Initial load
+    setDataLoading(true);
     loadData();
 
     StopDataProvider.pushRecent(parseInt(params.id ?? ""));
     setFavourited(
       StopDataProvider.isFavourite(parseInt(params.id ?? ""))
     );
+    setDataLoading(false);
   }, [params.id, loadData]);
 
   const toggleFavourite = () => {
-- 
cgit v1.3

