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:
parent
45c40ecea3
commit
b25c5a9505
2 changed files with 0 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue