SSWConsulting / SSWConsulting/SSW.Website
💄 Header - Mobile header flashes flag/Contact for one frame before hiding
@isaaclombardssw is already working on this.
Since Jul 23, 2026.
- Dominant language
- HTML
- Stars
- 14
- Forks
- 10
- Avg merge
- 13h 51m
- Merged PRs (30d)
- 38
Description
Sub-issue of the AI for Business Leaders performance PBI. Highest blast radius of the set — schedule it last.
Description
CLS is 0.133 and the cause is already documented in the code. app/components/header-appearance.tsx carries this note:
client context → SSR shows full header for one frame before hiding flag/contact. Upgrade path if the flash matters: set
x-pathnamein middleware.ts and resolve appearance server-side in app/layout.tsx so the header renders correctly at SSR.
The header server-renders with the country flag and the Contact button present. After hydration, useMobileHeaderAppearance pushes the page's appearance into context and both are removed, reflowing the header and everything below it.
This page sets both flags in content/eventsv2/ai-for-business-leaders.json:
"appearance": { "hideFlag": true, "hideContactButton": true }
so it takes the full shift.
Proposed solution
Follow the upgrade path already written in the comment:
- Set an
x-pathnameheader inmiddleware.ts - Resolve the page's
appearanceserver-side inapp/layout.tsxand render the header correctly on the first paint - Keep the client context as the mechanism for client-side navigations
Because this touches middleware and the root layout, it affects every route — test broadly.
Acceptance criteria
- The header renders in its final form on first paint, with no post-hydration flag/Contact removal
- CLS on
/events/ai-for-business-leadersis below 0.1 - Client-side navigation between a page that hides the flag and one that doesn't still updates the header correctly
- The homepage, consulting pages and event pages all render the correct header variant
- No hydration mismatch warnings
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.