-
Notifications
You must be signed in to change notification settings - Fork 891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Shuffled choices issue #2639
Conversation
The latest updates on your projects. Learn more about Vercel for Git 鈫楋笌 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 馃檹 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dhruwang thanks for the great explanation in the issue description :-)
I tested the functionality and encountered a few smaller issues. Can you please take a look? 馃槉
packages/surveys/src/components/questions/MultipleChoiceMultiQuestion.tsx
Outdated
Show resolved
Hide resolved
packages/surveys/src/components/questions/MultipleChoiceMultiQuestion.tsx
Show resolved
Hide resolved
packages/surveys/src/components/questions/MultipleChoiceSingleQuestion.tsx
Show resolved
Hide resolved
...or)/environments/[environmentId]/surveys/[surveyId]/edit/components/SelectQuestionChoice.tsx
Outdated
Show resolved
Hide resolved
...or)/environments/[environmentId]/surveys/[surveyId]/edit/components/SelectQuestionChoice.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dhruwang thanks for making the changes; works great!! :-)
What does this PR do?
we used this piece of code to derive the question choices for multi select questions. If question contains some shuffleOption, it also shuffles and outputs the shuffled choices. Here
question.choices
is included in the dependency array, which changes when user changes the choice label in survey editor, which further triggers the recalculation of question choices, which agains shuffles the optionsSo now we calculate the shuffled order only once in the beginning and when some choice is added or removed.
This PR also disables the DND for question choices when shuffleOption(
randomize all
orall except last
) is selected.Fixes #2622
How should this be tested?
Play with shuffle options
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated