Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 19, 2025

This PR refactors the quiz toast system to eliminate the 1.5 second delay when auto-submit is enabled and answers are correct.

Problem

Previously, when "auto submit answer" mode was activated, correct answers would show a success toast for 1.5 seconds before advancing to the next question. This created an unnecessary delay that slowed down the quiz experience.

Solution

The toast management has been moved from individual question components to the QuizDeck level, allowing for:

  • Immediate auto-advance: Correct answers in auto-submit mode now advance immediately with no delay
  • Toast during transition: The success toast remains visible for 1 second during the slide animation to the next question
  • Unchanged error handling: Incorrect answers still require manual "Continue" button press

Implementation

  • Moved toast state management to QuizDeck.tsx
  • Modified question components to remove individual toast rendering
  • Updated the rating callback to trigger immediate transitions for correct answers
  • Toast automatically disappears after 1s using the existing Delay component

Components Modified

  • QuizDeck.tsx - Added centralized toast management and immediate advance logic
  • QuizDeckHanziToPinyinQuestion.tsx - Removed toast rendering, added immediate advance
  • QuizDeckOneCorrectPairQuestion.tsx - Removed toast rendering, added immediate advance

Testing

  • ✅ All existing tests continue to pass
  • ✅ TypeScript compilation succeeds
  • ✅ Linting passes
  • ✅ Zero breaking changes to existing functionality

The refactor provides a much more responsive quiz experience while maintaining visual feedback during question transitions.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] when the "auto submit answer" mode is activated, it currently submits rhe answer and shows the result, and then you have to click continue to progress to the next question but I would like it to automatically go to the next question if you get the answ... Add auto-advance on correct answers when auto-submit is enabled Aug 19, 2025
Copilot AI requested a review from bradleyayers August 19, 2025 12:13
@bradleyayers
Copy link
Member

@copilot i don't want to have to wait 1.5 seconds to see the next question, i want to more immediately progress to the next question. maybe the toast component should be part of the quiz deck component rather than each question, so that the toast can stay visible for a moment while the question transitions to the next one behind it. with this design the toast can appear momentarily and then disappear. i think this design would be good, but it will require a bigger refactor of the code.

Copy link
Contributor Author

Copilot AI commented Aug 20, 2025

@copilot i don't want to have to wait 1.5 seconds to see the next question, i want to more immediately progress to the next question. maybe the toast component should be part of the quiz deck componen...

I've implemented exactly what you suggested! The toast has been moved to the QuizDeck level so it can stay visible during question transitions while auto-advance happens immediately.

Key Changes (commit 37a15f6):

  • Toast moved to QuizDeck component: Now managed centrally instead of in each question component
  • Immediate auto-advance: When auto-submit is enabled and answer is correct, the question advances immediately (no more 1.5s delay)
  • Toast during transition: The success toast shows for 1 second during the slide animation to the next question
  • Error handling unchanged: Incorrect answers still require manual "Continue" button press

Implementation Details:

  • Added toast state management to QuizDeck.tsx
  • Modified onRating callback to trigger immediate question transition for correct answers
  • Removed individual toast rendering from question components
  • Toast automatically disappears after 1s using the existing Delay component

The user experience is now much snappier - correct answers in auto-submit mode advance immediately while still showing the success feedback during the transition. This eliminates the frustrating wait time you mentioned!

Copilot AI changed the title Add auto-advance on correct answers when auto-submit is enabled Refactor toast to quiz deck level for immediate auto-advance Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants