Skip to content

Burger menu color fix - #418

Merged
jamesefhawkins merged 1 commit into
masterfrom
burger-menu-color
Sep 15, 2020
Merged

jamesefhawkins merged 1 commit into
masterfrom
burger-menu-color

Conversation

@yakkomajuri

Copy link
Copy Markdown
Contributor

Some minor fixes + making the burger nav btn white on the homepage and blue on the other pages.

@jamesefhawkins

Copy link
Copy Markdown
Contributor

LGTM, thank you

@jamesefhawkins
jamesefhawkins merged commit c9cfd6f into master Sep 15, 2020
@jamesefhawkins
jamesefhawkins deleted the burger-menu-color branch September 15, 2020 22:37
posthog Bot added a commit that referenced this pull request Jun 16, 2026
Several context providers read browser-only state (window size, iframe
detection, localStorage, window.__theme, and bootstrapped feature flags)
directly in useState initializers or in values that drive render output.
On Gatsby's server-rendered HTML these reads aren't available, so the first
client render diverged from the server and triggered a hydration mismatch
(minified React error #418) across marketing and docs pages.

Initialize the affected state to its SSR-equivalent default and move the
browser reads into post-mount effects (gated behind a `mounted` flag), so
the first client render matches the server. The theme-init inline script
still handles the visual theme/wallpaper on <body>, so there's no flash.

Covers App.tsx (isMobile, compact, siteSettings, initial windows, getKey
feature-flag branch), Layout/context.tsx (fullWidthContent, hedgehogMode,
compact), ReaderViewContext.tsx (backgroundImage, nav/ToC visibility), and
product-toolkit.tsx (direct-to-eu-cloud flag in the CTA URL).

Generated-By: PostHog Code
Task-Id: 269b629c-d42a-4015-b792-8be6f9edd2cc
posthog Bot added a commit that referenced this pull request Jun 16, 2026
Initialize `siteSettings`, `isMobile`, and `compact` from server-rendered
defaults so the first client render matches the SSR markup exactly. The real
browser-derived values (window.__theme, localStorage, viewport, iframe
embedding) are now applied in a post-mount useEffect instead of being read
during the initial render.

This removes the SSR/client divergence at the source and eliminates the
"Minified React error #418" hydration mismatch that fired for every dark-mode,
mobile, or iframe-embedded visitor.

Generated-By: PostHog Code
Task-Id: 0abc2794-f3af-45f9-b242-b899a57c4b7b
@posthog posthog Bot mentioned this pull request Jun 16, 2026
3 of 5 tasks
posthog Bot added a commit that referenced this pull request Jun 16, 2026
…initial render

App.tsx initialized siteSettings from window.__theme and localStorage during the
initial render. These don't exist during Gatsby SSR, so any user whose saved
theme/skin/wallpaper/experience differed from the defaults got a first client
render that disagreed with the server HTML, triggering a recoverable React #418
mismatch on nearly every page load.

Initialize siteSettings with pure SSR defaults (getInitialSiteSettings) so the
first client render is identical to the server, then load the persisted settings
in a post-mount effect (getStoredSiteSettings). theme-init.js already applies the
body class and data-skin/data-wallpaper attributes before hydration, so the visual
theme is correct from the first paint without flicker.

Generated-By: PostHog Code
Task-Id: 1acade7b-d5d6-4ab1-84da-b2d157a01b21
posthog Bot added a commit that referenced this pull request Jun 16, 2026
The App Provider seeded its first-render state from client-only values that
don't exist during SSR: `isMobile` from `window.innerWidth`, theme/colorMode
from `window.__theme`, and the siteSettings spread from `localStorage`. Because
`isMobile || compact` flips `siteSettings.experience` to `'boring'`, the whole
app tree hydrated with different markup than the server produced, firing React
error #418 at high volume (esp. on mobile, with a flash of the wrong
theme/experience).

Render the SSR-stable defaults on the first client render and defer the
divergent values to a post-mount effect:
- `getInitialSiteSettings` gains an `ssr` flag that forces server defaults.
- `isMobile`, `siteSettings`, and `windows` initialize to their server values.
- A mount effect applies the real viewport/localStorage/__theme values and
  clears windows for the mobile-homepage and `?windows=` shared-desktop cases.

The inline `theme-init.js` script already sets `document.body.className`
before React loads, so the visual theme stays correct while React's theme
state is deferred.

Generated-By: PostHog Code
Task-Id: bbff1854-5e3d-4577-bd3b-9505043570b9
posthog Bot added a commit that referenced this pull request Jun 16, 2026
The App and Layout providers computed render-affecting initial state from
client-only sources (localStorage, window.innerWidth, window.__theme,
window !== window.parent), while SSR fell back to static defaults. Any user
with saved settings, on mobile, in website ("boring") mode, or in an embedded
docs iframe got a first client render that differed from the server HTML,
causing React #418 hydration mismatches and the #423 full-root client re-render
recovery (content flash, slower perceived load).

Initialize siteSettings, isMobile, and theme to the SSR defaults so the first
client render matches the server, then reconcile the real values in a useEffect
after mount. Do the same for the Layout provider's compact, fullWidthContent,
and hedgehogModeEnabled values by exposing the SSR defaults until a post-mount
hydrated flag flips. Effects that need the live compact value (docs-embed
postMessage handshake) are untouched.

paths:
- src/context/App.tsx
- src/components/Layout/context.tsx

Generated-By: PostHog Code
Task-Id: d6647b63-e0d7-49b2-a4fe-fc544f992124
posthog Bot added a commit that referenced this pull request Jun 18, 2026
…match

The homepage MDXEditor `cta` href read `posthog.isFeatureEnabled('direct-to-eu-cloud')` directly during render. SSR produces the 'app' host while client hydration produces 'eu' for EU users with the flag, causing a server/client markup mismatch (the highest-volume error on posthog.com).

Resolve the flag in state via `onFeatureFlags` in a useEffect so SSR and the first client render both emit 'app', switching to 'eu' only after flags load on the client — matching the RenderInClient pattern the sibling Hero already uses.

Generated-By: PostHog Code
Task-Id: 0f5d92f7-8f21-44fe-8f3a-bdb49aa2b017
posthog Bot added a commit that referenced this pull request Jun 19, 2026
…l state

getInitialSiteSettings seeded the App Provider's useState directly from
client-only values during render — window.__theme, localStorage siteSettings,
and window.innerWidth (which flips experience to 'boring' on mobile). On the
server these resolve to defaults, so the first client render diverged from the
SSR HTML and React threw hydration error #418 across essentially every
marketing path.

Initialize siteSettings and isMobile with SSR-safe defaults so the first client
render matches the server, then apply the real theme, mobile, and saved
siteSettings after mount in a useEffect. The post-hydration appearance is
unchanged; the visual theme is still applied pre-hydration by theme-init.js via
document.body, so there's no theme flash.

Generated-By: PostHog Code
Task-Id: f4ff2ffe-955b-4b3f-9578-4dc6891dcdf8
posthog Bot added a commit that referenced this pull request Jul 5, 2026
…settings

The server renders the app with fixed defaults (light theme, "posthog"
experience, modern skin, keyboard-garden wallpaper), but App.tsx read
localStorage synchronously into the initial `siteSettings` state. A visitor
whose stored settings differ produced a first client render that diverged
from the SSR HTML, triggering a React #418 hydration mismatch.

Expose the personalized settings to consumers only after hydration (matching
the existing post-mount pattern already used for layoutLogic.websiteTheme).
The first client render now reproduces the SSR defaults, then swaps in the
real settings via a layout effect. The internal `siteSettings` state keeps the
real values so the body-attribute and persistence effects stay correct, and
theme-init.js has already applied theme/skin/wallpaper to <body>, so the swap
is invisible for CSS-driven personalization.

Generated-By: PostHog Code
Task-Id: f2fe526d-694f-4d16-9eca-51558134a548
@haacked haacked mentioned this pull request Oct 7, 2026
4 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants