Skip to content

Add Zustand persist middleware for quiz state persistence#822

Open
deslawson wants to merge 1 commit into
rinafcode:mainfrom
deslawson:Tech-debt]-quizStore-has-no-persistence-—-quiz-state-is-lost-on-page-refresh-#755

Hidden character warning

The head ref may contain hidden characters: "Tech-debt]-quizStore-has-no-persistence-\u2014-quiz-state-is-lost-on-page-refresh-#755"
Open

Add Zustand persist middleware for quiz state persistence#822
deslawson wants to merge 1 commit into
rinafcode:mainfrom
deslawson:Tech-debt]-quizStore-has-no-persistence-—-quiz-state-is-lost-on-page-refresh-#755

Conversation

@deslawson

@deslawson deslawson commented Jun 28, 2026

Copy link
Copy Markdown

Description

Wrapped quizStore with Zustand's persist middleware using sessionStorage to save currentQuiz, currentQuestionIndex, answers, startTime, and isReviewMode. A page refresh during a quiz now rehydrates the store from sessionStorage, restoring the exact question and all answers. On endQuiz, the completed result is saved to a localStorage history key (teachlink-quiz-history) and sessionStorage is cleared via persist.clearStorage(). Exported CompletedQuiz type and getCompletedQuizzes() helper for reviewing past results. Added 5 unit tests covering persistence, rehydration, history saving, reset, and startTime idempotency.

Related Issue

Closes #755

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

Closes #755

 Wrapped quizStore with Zustand's persist middleware using sessionStorage to save currentQuiz, currentQuestionIndex, answers, startTime, and isReviewMode. A page refresh during a quiz now rehydrates the store from sessionStorage, restoring the exact question and all answers. On endQuiz, the completed result is saved to a localStorage history key (teachlink-quiz-history) and sessionStorage is cleared via persist.clearStorage(). Exported CompletedQuiz type and getCompletedQuizzes() helper for reviewing past results. Added 5 unit tests covering persistence, rehydration, history saving, reset, and startTime idempotency.

Closes rinafcode#755
@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@deslawson Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Great job so far

There’s just one blocker — merge conflict. Could you take a look and resolve it?

Happy to review again once that’s done.

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

kindly resolve conflict

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.

[Tech-debt] quizStore has no persistence — quiz state is lost on page refresh

2 participants