-
Notifications
You must be signed in to change notification settings - Fork 136
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
feat: Add a onPreviewSubmit callback to preview surveys #1641
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +3.86 kB (+0.12%) Total Size: 3.23 MB
ℹ️ View Unchanged
|
const surveyPreviewRef = useRef<HTMLDivElement>(null) | ||
const [currentPageIndex, setCurrentPageIndex] = useState(0) | ||
|
||
console.log('Current page index:', currentPageIndex) |
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.
Do we need this log here?
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.
We might want to add a linter to forbid this
src/extensions/surveys.tsx
Outdated
@@ -618,6 +627,7 @@ export function Questions({ | |||
originalQuestionIndex, | |||
displayQuestionIndex, | |||
}), | |||
onPreviewSubmit: (res) => onPreviewSubmit(res), |
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.
onPreviewSubmit: (res) => onPreviewSubmit(res), | |
onPreviewSubmit, |
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.
thanks updated both!
Not sure if the team has let you known how |
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.
looks solid to me!
Changes
Adds a new
onPreviewSubmit
parameter torenderSurveysPreview
.The main usage of
renderSurveysPreview
is on posthog internal website to demo surveys.By adding this callback, it allow us to call arbitrary functions after pressing the submit button in the survey.
It'll be used to fix this issue: PostHog/posthog#23650 and allow us to move to the next question after clicking the submit button.
...
Checklist