Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(marketing): prevent desktop demo flashing on mobile startup (#8457)

Chaitanya Agarwald319e4e4e9c0
diff --git a/apps/marketing/README.md b/apps/marketing/README.md
index ecbda04d53..4d12727cc7 100644
--- a/apps/marketing/README.md
+++ b/apps/marketing/README.md
@@ -514,6 +514,9 @@ backing, and ISO/SOC 2/CASA badges. A continuous grainy gradient funnels into th
GitHub mark on scroll, then drains away. Verify the flow in both scroll directions
and after resizing. Reduced motion skips the flow
and shows the finished GitHub treatment.
+The 800px desktop-demo breakpoint is also enforced by CSS on prerendered HTML,
+so phones never paint the desktop carousel before hydration switches layouts.
+The production smoke checks visibility before and after releasing JavaScript.
Below 800px, the homepage keeps the original sequence: feature bubbles, the full
open-source section, then a curved connector into the abbreviated sidebar diagram.
The embedded demo, carousel, liquid transition, and demo launch button do not mount
diff --git a/apps/marketing/scripts/verifyHomepage.ts b/apps/marketing/scripts/verifyHomepage.ts
index aa5dfd2a6f..9df0d230cd 100644
--- a/apps/marketing/scripts/verifyHomepage.ts
+++ b/apps/marketing/scripts/verifyHomepage.ts
@@ -78,6 +78,12 @@ export async function verifyHomepage(directory: string): Promise<void> {
`Homepage SSR root height is ${rootHeight}, expected viewport height ${viewport.height} (${label})`
);
+ // The SSR fallback is desktop, but CSS must hide it on phones before
+ // hydration replaces it with the mobile story. Otherwise it flashes in.
+ const desktopDemo = page.locator('.homepage-embedded-demo');
+ if (viewport.width < 800) await expect(desktopDemo).toBeHidden();
+ else await expect(desktopDemo).toBeVisible();
+
releaseScripts();
await page.waitForLoadState('load');
if (errors.length)
@@ -91,6 +97,10 @@ export async function verifyHomepage(directory: string): Promise<void> {
timeout: 10000,
}
);
+ if (viewport.width < 800) {
+ await expect(desktopDemo).toHaveCount(0);
+ await expect(page.locator('.homepage-mobile-story')).toBeVisible();
+ } else await expect(desktopDemo).toBeVisible();
await page.evaluate(async () => {
await document.fonts.ready;
await new Promise<void>((resolve) =>
diff --git a/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx b/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx
index 22be8bfaab..ab42dcf696 100644
--- a/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx
+++ b/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx
@@ -160,6 +160,8 @@ export function HomepageOpenSource(props: {
children: JSX.Element;
showSidebarBreakdown: boolean;
}) {
+ // CSS applies this same breakpoint to server markup before hydration can
+ // replace it with the mobile story. Keep the two thresholds aligned.
const desktop = createMediaQuery('(min-width: 800px)', true);
return (
<Show
diff --git a/apps/marketing/src/features/marketing/components/homepage-open-source.css b/apps/marketing/src/features/marketing/components/homepage-open-source.css
index 346010d949..aeb4f2b760 100644
--- a/apps/marketing/src/features/marketing/components/homepage-open-source.css
+++ b/apps/marketing/src/features/marketing/components/homepage-open-source.css
@@ -62,3 +62,9 @@ html[data-palette='cream'] .homepage-demo-slide-dot[aria-pressed=true] span { ba
/* Keep the restored agent composer above the decorative caption and fade. */
.homepage-embedded-demo:has(.homepage-demo-carousel[data-active-scene='Agents']) .homepage-embedded-window { box-sizing: border-box; padding-bottom: 136px; }
.homepage-embedded-demo:has(.homepage-demo-carousel[data-active-scene='Agents']) .homepage-embedded-stage::after { inset: calc(100% - 160px) 0 -1px; }
+
+/* Match HomepageOpenSource's viewport gate before hydration. The server sends
+ desktop markup; phones must never paint it before the mobile branch mounts. */
+@media (max-width: 799px) {
+ .homepage-embedded-demo { display: none; }
+}