From b25c5a9505d4433e436f86e43efedeb6145a8e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sat, 23 May 2026 13:00:43 +0200 Subject: [PATCH] Fix import-all skipping every other workout When a workout is imported and the loader revalidates, importableWorkouts shrinks. The snapshot-update useEffect was overwriting the ref with the shorter list, causing the index to point to the wrong item and skip every alternate workout. Remove the snapshot update so the original list is used throughout the import-all session. Co-Authored-By: Claude Sonnet 4.6 --- apps/journal/app/routes/sync.import.$provider.tsx | 4 ---- apps/journal/app/routes/sync.import.komoot.tsx | 4 ---- 2 files changed, 8 deletions(-) diff --git a/apps/journal/app/routes/sync.import.$provider.tsx b/apps/journal/app/routes/sync.import.$provider.tsx index e90b811..fce797a 100644 --- a/apps/journal/app/routes/sync.import.$provider.tsx +++ b/apps/journal/app/routes/sync.import.$provider.tsx @@ -205,10 +205,6 @@ export default function SyncImportPage({ loaderData }: Route.ComponentProps) { const importAllFetcher = useFetcher<{ imported?: string }>(); const importAllRef = useRef({ index: 0, workouts: importableWorkouts }); - useEffect(() => { - importAllRef.current.workouts = importableWorkouts; - }, [importableWorkouts]); - useEffect(() => { if (!importAllActive) return; if (importAllFetcher.state !== "idle") return; diff --git a/apps/journal/app/routes/sync.import.komoot.tsx b/apps/journal/app/routes/sync.import.komoot.tsx index 5b91086..02bdfdf 100644 --- a/apps/journal/app/routes/sync.import.komoot.tsx +++ b/apps/journal/app/routes/sync.import.komoot.tsx @@ -162,10 +162,6 @@ export default function KomootImportPage({ loaderData }: Route.ComponentProps) { const importAllFetcher = useFetcher<{ imported?: string }>(); const importAllRef = useRef({ index: 0, workouts: importableWorkouts }); - useEffect(() => { - importAllRef.current.workouts = importableWorkouts; - }, [importableWorkouts]); - useEffect(() => { if (!importAllActive) return; if (importAllFetcher.state !== "idle") return;