We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents acc8756 + 0db6219 commit 710c864Copy full SHA for 710c864
src/components/Quiz/QuizWidget/useQuizWidget.tsx
@@ -1,4 +1,5 @@
1
import { useEffect, useMemo, useState } from "react"
2
+import isChromatic from "chromatic"
3
import shuffle from "lodash/shuffle"
4
import { useTranslation } from "next-i18next"
5
@@ -51,7 +52,9 @@ export const useQuizWidget = ({
51
52
const rawQuestion: RawQuestion = questionBank[id]
53
return { id, ...rawQuestion }
54
})
- const shuffledQuestions = shuffle(questions)
55
+
56
+ // ! Do not shuffle questions in Chromatic to keep the modal story snapshot stable
57
+ const shuffledQuestions = isChromatic() ? questions : shuffle(questions)
58
const quiz: Quiz = {
59
title: t(rawQuiz.title),
60
questions: shuffledQuestions,
0 commit comments