Mobile: Scrollposition nach Popup-Schliessen erhalten (stiller Refresh)
Deploy App / deploy (push) Successful in 55s

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 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 08:15:12 +02:00
parent a8a780d1ef
commit 6654192d83
+6 -4
View File
@@ -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) {