SIGN IN SIGN UP

fix(surveys): stop storing incomplete prefilled responses, and keep question order stable (#4548)

* fix(surveys): store a response only on completion when partial is off

Two web SDK paths stored a one-answer response for a survey configured to store a response only when every question is answered.

- _handleInitialResponses sent unconditionally. It now shares the partial-response gate that _handleUrlPrefill already uses, so the two prefill paths agree.
- Shuffled questions passed a display-order index straight into getNextSurveyStep, which reads survey.questions by canonical index. Branching evaluated the wrong question and could return End after one answer. The display index now converts to the canonical index before branching and back afterwards.

Both sends also mark the survey seen and set the responded person property, so a premature send locked the respondent out of finishing.

Generated-By: PostHog Desktop
Task-Id: b913790c-5dcf-4103-ab9f-04ed91397d1c

* chore(surveys): register _autoSubmitPrefilledResponses mangled name

The new private method needs an entry in terser-mangled-names.json so the minified property name stays consistent across builds.

Generated-By: PostHog Desktop
Task-Id: b913790c-5dcf-4103-ab9f-04ed91397d1c

* fix(surveys): gate prefilled responses and stop shuffling when order matters

Prefilled responses now share the URL-prefill completion gate, and question
shuffling is skipped when branching or in-progress state indexes the configured
question order.

* docs(surveys): split changeset into one entry per user-facing fix

* style(surveys): drop comments that restate the code

* fix(surveys): keep the question order a resumed survey was indexed against

In-progress state records the question order its indices point into, so a
shuffled survey no longer reshuffles on resume and read its saved position
against a different order.

* refactor(surveys): supersede the in-progress shuffle guard with the recorded order

* docs(surveys): disclose the narrowed partial event and prefill ordering

* docs(surveys): consolidate the changesets into one entry

---------

Co-authored-by: posthog[bot] <206114724+posthog[bot]@users.noreply.github.com>
Co-authored-by: Anna Garcia <anna.g@posthog.com>
P
posthog[bot] committed
fe933d87f345d435d0e959f57163fe18eaa23794
Parent: 4ca7bed
Committed by GitHub <noreply@github.com> on 8/25/2026, 6:01:05 PM