From 6654192d83ef2598ec55c23d40ddf6878b048f16 Mon Sep 17 00:00:00 2001 From: kelle Date: Tue, 14 Jul 2026 08:15:12 +0200 Subject: [PATCH] Mobile: Scrollposition nach Popup-Schliessen erhalten (stiller Refresh) refreshCurrent laedt den Plan-Detail neu OHNE Loading-Umschaltung, damit die PlanView montiert bleibt und die Scrollposition nicht auf 0/0 zurueckspringt. Der Spinner erscheint weiterhin nur beim initialen Plan-Wechsel. Co-Authored-By: Claude Opus 4.8 --- src/components/AppShell.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/AppShell.tsx b/src/components/AppShell.tsx index f772ec4..6b22b51 100644 --- a/src/components/AppShell.tsx +++ b/src/components/AppShell.tsx @@ -42,13 +42,15 @@ export function AppShell({ username }: { username: string }) { return data.plans; }, []); - const loadDetail = useCallback(async (planId: string) => { - setLoading(true); + // silent = Hintergrund-Refresh ohne Loading-Umschaltung: die PlanView bleibt montiert, + // damit die Scrollposition (z. B. nach dem Schliessen eines Popups) erhalten bleibt. + const loadDetail = useCallback(async (planId: string, silent = false) => { + if (!silent) setLoading(true); try { const data = await api.get<{ plan: PlanInput; computed: PlanComputed }>(`/api/plans/${planId}`); setDetail(data); } finally { - setLoading(false); + if (!silent) setLoading(false); } }, []); @@ -67,7 +69,7 @@ export function AppShell({ username }: { username: string }) { }, [selectedPlanId, loadDetail]); function refreshCurrent() { - if (selectedPlanId) loadDetail(selectedPlanId); + if (selectedPlanId) loadDetail(selectedPlanId, true); } async function handleDeletePlan(id: string) {