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): load homepage demo iframe without loading="lazy" (#8105)

Jacob Beckerman7107a84c7465
diff --git a/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx b/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx
index 6960a7102e..500127cdcd 100644
--- a/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx
+++ b/apps/marketing/src/features/marketing/components/HomepageOpenSource.tsx
@@ -27,10 +27,24 @@ function DesktopHomepageOpenSource(props: {
scroller = scroller.parentElement;
}
onCleanup(animateDemoEntrance(section, scroller));
- // The sample workspace follows the OS color scheme on its own; a palette
- // pinned with `?theme=` carries over.
- const pinned = pinnedPalette();
- if (pinned) frame.src = `/demo?embedded=true&theme=${pinned}`;
+ // Load the workspace as it nears the viewport. Not loading="lazy": WebKit
+ // ignores history.replaceState in lazy frames, so the router throws on boot
+ // and Safari is left with the unstyled prerendered page.
+ const nearby = new IntersectionObserver(
+ (entries) => {
+ if (!entries.some((entry) => entry.isIntersecting)) return;
+ nearby.disconnect();
+ // The sample workspace follows the OS color scheme on its own; a
+ // palette pinned with `?theme=` carries over.
+ const pinned = pinnedPalette();
+ frame.src = pinned
+ ? `/demo?embedded=true&theme=${pinned}`
+ : '/demo?embedded=true';
+ },
+ { rootMargin: '1250px 0px' }
+ );
+ nearby.observe(section);
+ onCleanup(() => nearby.disconnect());
if (!props.showSidebarBreakdown) return;
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)');
const card = connection.querySelector<HTMLElement>(
@@ -110,10 +124,9 @@ function DesktopHomepageOpenSource(props: {
</Show>
<iframe
ref={frame}
- src="/demo?embedded=true"
- loading="lazy"
title="Embedded Macro sample workspace"
- onLoad={() => setLoaded(true)}
+ // Ignore the initial about:blank load before src is set.
+ onLoad={() => frame.src && setLoaded(true)}
/>
</div>
</div>