Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(marketing): style product pages before their first paint (#8523)
Chaitanya Agarwalcb3045a57ab3
diff --git a/apps/marketing/README.md b/apps/marketing/README.mdindex 2278e68f8b..1241aa2d66 100644--- a/apps/marketing/README.md+++ b/apps/marketing/README.md@@ -1066,3 +1066,10 @@ restores compact dimensions before the header reappears; keep one app link.The landing-page CRM illustration has a transparent outer frame with nodecorative rim in either palette. Keep the inner CRM window surface and shadow.++Prerender product routes must link the styles for their actual lazy module before+JavaScript runs. Keep the route asset map aligned with App imports; shared Vite+dynamic entries can have generated manifest keys, so resolve their unique entry+names and fail on missing/ambiguous entries. Product logos carry intrinsic 20px+dimensions. The production product checks hold scripts and verify styled heroes+and correctly sized logos before releasing them.diff --git a/apps/marketing/scripts/prerender.ts b/apps/marketing/scripts/prerender.tsindex 1ee46173aa..57432c97f8 100644--- a/apps/marketing/scripts/prerender.ts+++ b/apps/marketing/scripts/prerender.ts@@ -91,12 +91,12 @@ const ROUTE_MODULES: Array<[RegExp, string]> = [[/^\/dpa$/, 'src/app/routes/RouteDpa.tsx'],[/^\/tasks$/, 'src/app/routes/RouteTasks.tsx'],[/^\/email$/, 'src/app/routes/RouteEmail.tsx'],- [/^\/documents$/, 'src/app/routes/RouteDocuments.tsx'],- [/^\/channels$/, 'src/app/routes/RouteChannels.tsx'],- [/^\/calls$/, 'src/app/routes/RouteCalls.tsx'],+ [/^\/documents$/, 'src/features/marketing/views/ProductDocumentsPage.tsx'],+ [/^\/channels$/, 'src/features/marketing/views/ProductChannelsPage.tsx'],+ [/^\/calls$/, 'src/features/marketing/views/ProductCallsPage.tsx'],[/^\/crm$/, 'src/app/routes/RouteCrm.tsx'],- [/^\/agents$/, 'src/app/routes/RouteAgents.tsx'],- [/^\/github$/, 'src/app/routes/RouteGithub.tsx'],+ [/^\/agents$/, 'src/features/marketing/views/ProductAgentsPage.tsx'],+ [/^\/github$/, 'src/features/marketing/views/ProductReviewsPage.tsx'],[/^\/pricing$/, 'src/app/routes/RoutePricing.tsx'],[/^\/download$/, 'src/app/routes/RouteDownload.tsx'],[/^\/tour$/, 'src/features/marketing/views/SalesPage.tsx'],@@ -111,6 +111,8 @@ const ROUTE_MODULES: Array<[RegExp, string]> = [interface ManifestChunk {file: string;+ name?: string;+ isDynamicEntry?: boolean;css?: string[];imports?: string[];}@@ -121,16 +123,30 @@ function collectChunkAssets(manifest: Manifest,key: string): { js: string[]; css: string[] } {+ // Vite may emit a shared dynamic route under a generated _Name-hash.js key+ // rather than its source path (CRM does this). Resolve that real entry too.+ const candidates = manifest[key]+ ? [key]+ : Object.keys(manifest).filter(+ (candidate) =>+ manifest[candidate].isDynamicEntry &&+ manifest[candidate].name === path.basename(key, path.extname(key))+ );+ if (candidates.length !== 1)+ throw new Error(+ `Expected one built route entry for ${key}, found ${candidates.length}`+ );const js = new Set<string>();const css = new Set<string>();const visit = (k: string) => {const chunk = manifest[k];- if (!chunk || js.has(chunk.file)) return;+ if (!chunk) throw new Error(`Missing static route dependency: ${k}`);+ if (js.has(chunk.file)) return;js.add(chunk.file);for (const c of chunk.css ?? []) css.add(c);for (const imp of chunk.imports ?? []) visit(imp);};- visit(key);+ visit(candidates[0]);return { js: [...js], css: [...css] };}diff --git a/apps/marketing/scripts/verifyProductPages.ts b/apps/marketing/scripts/verifyProductPages.tsindex 451c55bc85..cf028a78ef 100644--- a/apps/marketing/scripts/verifyProductPages.ts+++ b/apps/marketing/scripts/verifyProductPages.ts@@ -19,17 +19,47 @@ export async function verifyProductPages(browser: Browser, origin: string) {reducedMotion: 'reduce',colorScheme: 'dark',});+ let releaseScripts!: () => void;+ const scriptsReady = new Promise<void>((resolve) => {+ releaseScripts = resolve;+ });const errors: string[] = [];page.on('pageerror', (error) => errors.push(error.message));await page.route('**/*', async (request) => {if (new URL(request.request().url()).origin !== origin)await request.abort();- else await request.continue();+ else {+ if (request.request().resourceType() === 'script') await scriptsReady;+ await request.continue();+ }});try {- await page.goto(`${origin}${route}`, { waitUntil: 'load' });+ await page.goto(`${origin}${route}`, { waitUntil: 'commit' });const heading = page.locator('.feature-page-hero h1');await expect(heading).toBeVisible();+ await page.evaluate(() => document.fonts.ready);+ // These must hold before route JavaScript can repair missing CSS. A+ // stale prerender asset entry previously painted a 1000px brand SVG.+ const brand = page.locator('.product-home-link > svg');+ const initialBrand = await brand.boundingBox();+ expect(initialBrand?.width, `${route}: first-paint logo width`).toBe(20);+ expect(initialBrand?.height, `${route}: first-paint logo height`).toBe(+ 20+ );+ await expect(heading).toHaveCSS('font-family', /Roboto Slab/);+ const padding = await page+ .locator('.email-page-hero')+ .evaluate((element) =>+ Number.parseFloat(getComputedStyle(element).paddingTop)+ );+ expect(+ padding,+ `${route}: hero styled before JavaScript`+ ).toBeGreaterThan(100);+ releaseScripts();+ await page.waitForLoadState('load');+ await expect(brand).toHaveAttribute('width', '20');+ await expect(brand).toHaveAttribute('height', '20');const demos = page.locator('.demo-interaction-boundary').filter({has: page.locator(':scope > .demo-interaction-activate'),});@@ -117,6 +147,7 @@ export async function verifyProductPages(browser: Browser, origin: string) {`[prerender] ${route}: ${count} mobile demos accept touch entry and return to page scrolling`);} finally {+ releaseScripts();await page.close();}}diff --git a/apps/marketing/src/features/marketing/components/product/ProductPage.tsx b/apps/marketing/src/features/marketing/components/product/ProductPage.tsxindex 9404d5489e..94c7524d03 100644--- a/apps/marketing/src/features/marketing/components/product/ProductPage.tsx+++ b/apps/marketing/src/features/marketing/components/product/ProductPage.tsx@@ -25,7 +25,7 @@ export function ProductBrand(props: { product: string }) {class="product-home-link"aria-label="Macro home">- <MacroLogo aria-hidden="true" />+ <MacroLogo width="20" height="20" aria-hidden="true" /><span>Macro</span></a><span aria-hidden="true">/</span>