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(surveys): multiple choice survey submit button bug #822

Merged
merged 2 commits into from
Oct 4, 2023

Conversation

liyiy
Copy link
Contributor

@liyiy liyiy commented Oct 4, 2023

Changes

Single choice surveys could not be submitted bug

Regular querySelector here returns element instead of a list of elements so we should not check .length on it

Checklist

@liyiy liyiy added the bump patch Bump patch version when this PR gets merged label Oct 4, 2023
@liyiy liyiy requested a review from neilkakkar October 4, 2023 16:39
@liyiy
Copy link
Contributor Author

liyiy commented Oct 4, 2023

I think I'm going to add some more tests... but let's get this in ASAP first...

@github-actions
Copy link

github-actions bot commented Oct 4, 2023

Size Change: -2 B (0%)

Total Size: 726 kB

Filename Size Change
dist/surveys.js 38.7 kB -2 B (0%)
ℹ️ View Unchanged
Filename Size
dist/array.full.js 177 kB
dist/array.js 119 kB
dist/es.js 119 kB
dist/module.js 119 kB
dist/recorder-v2.js 95 kB
dist/recorder.js 58.3 kB

compressed-size-action

@@ -635,7 +635,7 @@ export const createMultipleChoicePopup = (posthog: PostHog, survey: Survey, ques
: formElement.querySelectorAll('input[type=checkbox]:checked')
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // TODO: Fix this, error because it doesn't recognize node list as an array
if (selectedChoices && (selectedChoices.length ?? 0) > 0) {
if ((singleOrMultiSelect === 'single_choice' && selectedChoices) || (selectedChoices.length ?? 0) > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason not to use querySelectorAll above for single choice as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

THAT MAKES A LOT OF SENSE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wait i'm going to test it real quick locally first though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok it works

@liyiy liyiy requested a review from neilkakkar October 4, 2023 16:57
@liyiy liyiy merged commit d4d178a into master Oct 4, 2023
11 checks passed
@liyiy liyiy deleted the fix-surveys-multiple branch October 4, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants