Mobile: Scrollposition nach Popup-Schliessen erhalten (stiller Refresh)
Deploy App / deploy (push) Successful in 55s
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:
@@ -42,13 +42,15 @@ export function AppShell({ username }: { username: string }) {
|
|||||||
return data.plans;
|
return data.plans;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const loadDetail = useCallback(async (planId: string) => {
|
// silent = Hintergrund-Refresh ohne Loading-Umschaltung: die PlanView bleibt montiert,
|
||||||
setLoading(true);
|
// 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 {
|
try {
|
||||||
const data = await api.get<{ plan: PlanInput; computed: PlanComputed }>(`/api/plans/${planId}`);
|
const data = await api.get<{ plan: PlanInput; computed: PlanComputed }>(`/api/plans/${planId}`);
|
||||||
setDetail(data);
|
setDetail(data);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
if (!silent) setLoading(false);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -67,7 +69,7 @@ export function AppShell({ username }: { username: string }) {
|
|||||||
}, [selectedPlanId, loadDetail]);
|
}, [selectedPlanId, loadDetail]);
|
||||||
|
|
||||||
function refreshCurrent() {
|
function refreshCurrent() {
|
||||||
if (selectedPlanId) loadDetail(selectedPlanId);
|
if (selectedPlanId) loadDetail(selectedPlanId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDeletePlan(id: string) {
|
async function handleDeletePlan(id: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user