fix(surveys): use correct render method
Problem
In https://github.com/PostHog/posthog/pull/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
- Switch to
Preact.renderfor rendering previews - Some minor adjustments to render the Thank you message
This 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 https://github.com/PostHog/posthog/pull/20321
This change should be merged together with https://github.com/PostHog/posthog/pull/20321
Test
https://github.com/PostHog/posthog-js/assets/22996112/d640f9e8-6b8c-4d9d-885f-3f459080d671
Checklist
- [ ] Tests for new code (see advice on the tests we use)
- [ ] Accounted for the impact of any changes across different browsers
- [ ] Accounted for backwards compatibility of any changes (no breaking changes in posthog-js!)
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| posthog-js | ✅ Ready (Inspect) | Visit Preview | Apr 26, 2024 10:17am |
Size Change: -4.35 kB (0%)
Total Size: 971 kB
| Filename | Size | Change | |
|---|---|---|---|
dist/surveys-module-previews.js |
57.2 kB | -4.86 kB (-8%) | ✅ |
dist/surveys.js |
58.8 kB | +509 B (+1%) |
ℹ️ View Unchanged
| Filename | Size |
|---|---|
dist/array.full.js |
233 kB |
dist/array.js |
131 kB |
dist/es.js |
131 kB |
dist/exception-autocapture.js |
12.2 kB |
dist/module.js |
131 kB |
dist/recorder-v2.js |
108 kB |
dist/recorder.js |
108 kB |
Makes sense 👍 .
Heads up for the companion PR / cleanup, that the margins are off: