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): decode directory and showcase thumbnails off the critical path

nirholas4ebbf233a720
diff --git a/public/discover/discover.js b/public/discover/discover.js
index d121cd236..6ec63b557 100644
--- a/public/discover/discover.js
+++ b/public/discover/discover.js
@@ -441,7 +441,13 @@ function renderCard(item) {
*/
function renderThumb({ image, glbUrl, has3d, alt }) {
if (image) {
- return `<img src="${escapeAttr(image)}" alt="${escapeAttr(alt || '')}" loading="lazy" data-fallback="element" data-fallback-class="explore-card-ph" data-fallback-text="${has3d ? '🎭' : '🤖'}" />`;
+ // `decoding="async"` keeps the decode of every directory thumbnail off the
+ // critical rendering path. These are 768px source images painted into a
+ // 293px box, so a synchronous decode of a grid's worth of them lands as
+ // main-thread blocking time right when the page is trying to become
+ // interactive. The box itself is already reserved by CSS
+ // (.explore-card-thumb is `aspect-ratio: 1 / 1`), so nothing shifts.
+ return `<img src="${escapeAttr(image)}" alt="${escapeAttr(alt || '')}" loading="lazy" decoding="async" data-fallback="element" data-fallback-class="explore-card-ph" data-fallback-text="${has3d ? '🎭' : '🤖'}" />`;
}
if (glbUrl) {
return `<model-viewer
diff --git a/src/forge-showcase.js b/src/forge-showcase.js
index c0eef08f9..7d85fb579 100644
--- a/src/forge-showcase.js
+++ b/src/forge-showcase.js
@@ -384,6 +384,12 @@ function buildCard(c) {
const img = document.createElement('img');
img.className = 'thumb';
img.loading = 'lazy';
+ // Decode off the critical path: showcase thumbs are full-size renders
+ // painted into a 200px-tall box, and a synchronous decode of a grid's
+ // worth of them shows up as main-thread blocking time. The box is
+ // CSS-reserved (`#showcase .creation .thumb` is a fixed height), so
+ // deferring the decode cannot shift layout.
+ img.decoding = 'async';
img.alt = '';
img.src = c.preview_image_url;
img.onerror = () => {