-
Notifications
You must be signed in to change notification settings - Fork 131
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): use correct render method #1157
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: -4.35 kB (0%) Total Size: 971 kB
ℹ️ View Unchanged
|
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.
This makes total sense.
@@ -320,40 +315,66 @@ export function Questions({ | |||
setCurrentQuestion(idx + 1) | |||
} | |||
} | |||
const isMultipleQuestion = survey.questions.length > 1 | |||
|
|||
const questionToDisplay = readOnly ? previewQuestionIndex : currentQuestion |
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.
A bit annoying that in the main code we have to have special handling for previews, I expect this will become a lot more annoying when you need actual functionality with the branching logic for example.
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.
💯 , I want to clean this up
Problem
In PostHog/posthog#20321, surveys are rendered using
preact-render-to-string
. This method renders plain HTML, stripping any event listeners. Because of this, some interactions were not working (I had missed this in the initial review - my bad).Changes
Preact.render
for rendering previewsThis needs a much bigger cleanup, but annoying to do with the current slow iteration cycle - want to set up a better environment first. But this will get us over the line with PostHog/posthog#20321
This change should be merged together with PostHog/posthog#20321
Test
Screen.Recording.2024-04-26.at.12.14.54.mov
Checklist