Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

perf(discover): skip layout for offscreen catalogue cards with content-visibility

nirholas9591c30f6ec2
diff --git a/public/marketplace.css b/public/marketplace.css
index fdae25469..41cfa733b 100644
--- a/public/marketplace.css
+++ b/public/marketplace.css
@@ -204,6 +204,27 @@ body.market-page > header {
align-content: start;
}
+/* The discovery grid renders the whole catalogue at once. A Lighthouse desktop
+ trace measured #market-grid at 31,196px tall, of which one 940px screenful is
+ visible, and the browser paid full Style & Layout (11.8s) and Rendering
+ (16.1s) for every row of it on first render. `content-visibility: auto` skips
+ that work for a card until it nears the viewport and gives it back when the
+ card leaves. Both card types already clip their own contents (the avatar card
+ is `overflow: hidden`; the agent card's thumb uses a negative margin that
+ lands exactly on the padding box), so the paint containment this implies
+ changes nothing on screen. The size hints are a 4-column track at the grid's
+ 240px minimum plus each card's body; the leading `auto` keyword hands the
+ browser the real measurement once a card has rendered, so a taller-than-hinted
+ card never leaves a gap or jumps the scrollbar. */
+.market-grid > .market-card-avatar {
+ content-visibility: auto;
+ contain-intrinsic-size: auto 250px auto 370px;
+}
+.market-grid > .market-card-agent {
+ content-visibility: auto;
+ contain-intrinsic-size: auto 250px auto 300px;
+}
+
/* ── Category chips row ─────────────────────────────────────── */
.market-cat-chips {
display: flex;
diff --git a/public/style.css b/public/style.css
index 466d6e513..503b9d1aa 100644
--- a/public/style.css
+++ b/public/style.css
@@ -8375,6 +8375,18 @@ textarea.erc8004-code {
background 0.15s;
display: flex;
flex-direction: column;
+ /* /discover renders the whole directory in one grid, a few thousand pixels
+ of cards, of which one screenful is visible. Without this the browser
+ styles, lays out and paints every offscreen card on first render (3.1s of
+ Style & Layout plus 1.3s of Rendering in a Lighthouse desktop trace).
+ `auto` skips that work until a card nears the viewport and reverses it
+ when the card leaves again. The card is already `overflow: hidden`, so the
+ paint containment this implies changes nothing visually. The size hint is
+ a 1:1 thumb plus the body rows at the grid's 260px minimum track; `auto`
+ makes the browser replace it with the real measurement after the first
+ render, so a card that renders taller never leaves a gap behind. */
+ content-visibility: auto;
+ contain-intrinsic-size: auto 260px auto 420px;
}
.explore-card:hover {
border-color: rgba(255, 255, 255, 0.18);