Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(survey): Fix issue with shuffling questions on every render #1182

Merged
merged 1 commit into from
May 12, 2024

Conversation

Phanatic
Copy link
Contributor

Changes

This PR makes a fix to followup on #1177 where we discovered a bug that we weren't shuffling questions correctly.
The bug was in the survey rendering where we would repeatedly shuffle questions, causing us to sometimes lose questions when the component re-renders. This is now fixed by using the useMemo react hook to shuffle the questions for a given Survey only once.

duplicate_question_bug_fix

Checklist

  • Tests for new code (see advice on the tests we use)
  • Accounted for the impact of any changes across different browsers
  • Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)

Copy link

vercel bot commented May 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview May 12, 2024 2:53am

@Phanatic Phanatic requested a review from a team May 12, 2024 02:54
Copy link

Size Change: +58 B (+0.01%)

Total Size: 976 kB

Filename Size Change
dist/surveys-module-previews.js 57.7 kB +29 B (+0.05%)
dist/surveys.js 59.3 kB +29 B (+0.05%)
ℹ️ View Unchanged
Filename Size
dist/array.full.js 234 kB
dist/array.js 132 kB
dist/es.js 132 kB
dist/exception-autocapture.js 12.2 kB
dist/module.js 132 kB
dist/recorder-v2.js 108 kB
dist/recorder.js 108 kB

compressed-size-action

@Phanatic Phanatic added bump minor Bump minor version when this PR gets merged and removed bump minor Bump minor version when this PR gets merged labels May 12, 2024
Copy link
Contributor

@neilkakkar neilkakkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reasonable, nice!

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