Skip to content

Reset exercise-local state when redoing wrong answers #296

Description

@coderabbitai

Summary

The Finish session → Redo Wrong flow can replace the active exercise while Exercise remains mounted. Its component-local answer and isCorrect signals may then retain the previous exercise's state.

Required changes

Ensure that selecting Redo Wrong cannot display or submit stale answer/result state for the next exercise. Either:

  • reset the local exercise state whenever props.exercise changes, or
  • remount Exercise using a stable exercise identity.

Rationale

The redo flow updates the exercise queue independently of handleNext(), which is currently the path that clears the local input and correctness state.

Affected area

  • src/components/solid/Exercise/Exercise.tsx
  • Exercise session flow in src/components/solid/Exercise/Exercises.tsx

Acceptance criteria

  • After answering an exercise incorrectly, choosing Finish session → Redo Wrong clears the input and removes the previous correct/incorrect result before the next answer is checked.
  • The next submission is evaluated against the newly active exercise.
  • Existing normal next-exercise behavior remains unchanged.

Backlinks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions