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 <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-05-23 13:00:43 +02:00
parent 45c40ecea3
commit b25c5a9505
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
2 changed files with 0 additions and 8 deletions

View file

@ -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;

View file

@ -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;