mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-11-03 00:53:53 +00:00
avoid hydration errors https://github.com/PostHog/posthog-js/issues/2781 when someone is using SSR and we're lazy loading scripts we have a race between react hydrating and us altering the DOM if we manage to alter the DOM before hydration complests then we'll cause a hydration error i don't believe we care where the script is added (since we're adding it async from code the location isn't going to affect whether it blocks) so we can add the script to the head and not have any risk of causing a hydration error ### Libraries affected <!-- Please mark which libraries will require a version bump. --> - [ ] All of them - [x] posthog-js (web) - [ ] posthog-js-lite (web lite) - [ ] posthog-node - [ ] posthog-react-native - [ ] @posthog/react - [ ] @posthog/ai - [ ] @posthog/nextjs-config - [ ] @posthog/nuxt - [ ] @posthog/rollup-plugin - [ ] @posthog/webpack-plugin