-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: support branching in survey preview submit #27623
base: master
Are you sure you want to change the base?
Conversation
4cdf5d5
to
1b63b77
Compare
1b63b77
to
9efaf48
Compare
Size Change: 0 B Total Size: 1.13 MB ℹ️ View Unchanged
|
onPreviewSubmit={() => handleSetSelectedPageIndex(previewPageIndex + 1)} | ||
onPreviewSubmit={(response) => { | ||
handleSetSelectedPageIndex( | ||
getNextQuestionIndex( |
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.
Since the JS SDK is responsible for rendering the preview and the SDK already knows whats the next question, would be possible to let the JS SDK handle this altogether?
} | ||
} | ||
|
||
export function getNextQuestionIndex( |
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.
not sure if this is a copy-pasta from the JS SDK, but if not, you could inspire from in case something isn't working well.
Changed the PR title from |
Problem
when previewing surveys, we shouldn't just go to the next question when pressing submit.
instead, use the users' defined logic on branching.
Changes
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
No impact
How did you test this code?
Tested the feature on localhost
Unit tests