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.

fix(gallery): keep a pruned thumbnail from leaving a broken image box in a popular-search chip

nirholas96f7df6d8604
diff --git a/public/gallery/gallery.css b/public/gallery/gallery.css
index 3ac663be0..57d363e21 100644
--- a/public/gallery/gallery.css
+++ b/public/gallery/gallery.css
@@ -329,15 +329,17 @@ body.gallery-page {
.gallery-pop {
display: inline-flex;
align-items: center;
- gap: 7px;
+ gap: 6px;
+ /* Vertical padding trades against the 18px thumbnail so a popular-search chip
+ is exactly as tall as the category and rig chips sitting beside it. */
padding: 4px 12px;
}
/* Pull the thumbnail into the chip's left padding so a chip with imagery and one
without still line up on the same baseline grid. */
.gallery-pop-thumb {
- width: 22px;
- height: 22px;
- margin-left: -7px;
+ width: 18px;
+ height: 18px;
+ margin-left: -6px;
border-radius: 99px;
object-fit: cover;
background: rgba(255, 255, 255, 0.06);
diff --git a/public/gallery/gallery.js b/public/gallery/gallery.js
index 5e095bb20..23d9ad532 100644
--- a/public/gallery/gallery.js
+++ b/public/gallery/gallery.js
@@ -423,8 +423,10 @@ function renderPopular() {
els.pops.innerHTML = popularSearches
.map((s) => {
const active = s.query === state.query;
+ // Eager: these are 22px images at the top of the controls, always in the
+ // first viewport, so deferring them only delays the row settling.
const thumb = s.sample_thumbnail
- ? `<img class="gallery-pop-thumb" src="${escapeAttr(s.sample_thumbnail)}" alt="" loading="lazy" decoding="async" />`
+ ? `<img class="gallery-pop-thumb" src="${escapeAttr(s.sample_thumbnail)}" alt="" decoding="async" />`
: '';
const count = s.result_count > 0 ? `<span class="gallery-pop-count">${s.result_count}</span>` : '';
const label = active ? `Clear the ${s.query} search` : `Search for ${s.query}`;
@@ -435,6 +437,11 @@ function renderPopular() {
)}</span>${count}</button>`;
})
.join('');
+ // A thumbnail whose object was pruned would otherwise leave a broken-image
+ // box in the chip; drop the img and let the chip render as text only.
+ for (const img of els.pops.querySelectorAll('.gallery-pop-thumb')) {
+ img.addEventListener('error', () => img.remove(), { once: true });
+ }
}
async function loadPopularSearches() {