Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(toolbar): guard against null document.body in windowWidth (#65252)

posthog[bot]8d79d477c0a0
diff --git a/frontend/src/toolbar/bar/toolbarLogic.ts b/frontend/src/toolbar/bar/toolbarLogic.ts
index 5575c9af65a3..8355f058628a 100644
--- a/frontend/src/toolbar/bar/toolbarLogic.ts
+++ b/frontend/src/toolbar/bar/toolbarLogic.ts
@@ -138,7 +138,8 @@ export const toolbarLogic = kea<toolbarLogicType>([
})),
windowValues(() => ({
windowHeight: (window: Window) => window.innerHeight,
- windowWidth: (window: Window) => Math.min(window.innerWidth, window.document.body.clientWidth),
+ windowWidth: (window: Window) =>
+ Math.min(window.innerWidth, window.document.body?.clientWidth ?? window.innerWidth),
})),
reducers(() => ({
element: [