fix(card-sorting): lock spring positions after initial animation completes

After cards animate to grid positions, set immediate: true to prevent
any further animations (including on window resize).

Changes:
- After 1000ms animation, lock positions with immediate: true
- Cards will stay locked at grid positions
- No more re-animations on resize

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-10-23 23:10:03 -05:00
parent a44aa5a4c2
commit 275cc62a52

View File

@@ -138,7 +138,23 @@ export function ResultsPhase() {
}
})
}, 100)
return () => clearTimeout(timer)
// After animation completes, lock positions by setting immediate: true
const lockTimer = setTimeout(() => {
api.start((index) => {
const card = userSequence[index]
const correctIndex = state.correctOrder.findIndex((c) => c.id === card.id)
return {
to: calculateGridPosition(correctIndex),
immediate: true, // No more animations - locked in place
}
})
}, 1100) // Wait for animation to complete (100ms + 1000ms)
return () => {
clearTimeout(timer)
clearTimeout(lockTimer)
}
}, []) // Empty deps - only run once
// Show corrections after animation completes