Skip to content

[Bug] MobileQuizManager does not save draft answers between sessions — all answers lost on backgrounding #637

Description

@RUKAYAT-CODER

Overview

src/components/mobile/MobileQuizManager/ manages quiz answer state in local component state only. On iOS, if the system memory-evicts the app during a long quiz, all answers are lost when the user returns. For a 30-question quiz, this forces users to restart from question 1 despite having answered 20 questions.

Specifications

Features:

  • Quiz answers persisted to Zustand quiz store on every answer submission
  • Quiz store already persists via persist middleware — answers survive app kill
  • On quiz mount, check for in-progress session with same quizId
  • 'Resume quiz?' prompt shown if in-progress session found

Tasks:

  • Move answer state from component useState to quizStore.setAnswer(questionId, answer)
  • On quiz mount, check quizStore.quizId === currentQuizId and quizStore.answers
  • Show resume prompt if previous session detected
  • Add 'Start fresh' option that calls quizStore.resetQuiz()
  • Add unit test for persist → resume flow

Impacted Files:

  • src/components/mobile/MobileQuizManager/
  • src/store/slices/quizStore.ts

Acceptance Criteria

  • Answer submitted on question 15 persists across app kill and relaunch
  • Resume prompt shown on quiz relaunch with partial progress
  • 'Start fresh' clears all quiz state
  • Unit test confirms answers retrievable from store after simulated kill

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions