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(categories): make the 750-sector leaderboard searchable, paged and honest about failure

nirholas5d94fbd24400
diff --git a/docs/coin-pages.md b/docs/coin-pages.md
index 86699d0fc..29ad971ee 100644
--- a/docs/coin-pages.md
+++ b/docs/coin-pages.md
@@ -305,7 +305,12 @@ data" rule:
- **`/categories`** — every crypto sector ranked by market cap with 24h change,
volume, and the top coins in each. New `/api/coin/categories` (CoinGecko
`/coins/categories`). Each row opens a [category detail
- page](#categoryid--category-detail).
+ page](#categoryid--category-detail). CoinGecko reports 750+ categories, so the
+ table opens with the top 50 and pages in 50 more per click, and the search box
+ filters the full set by name or slug before you page. Every column sorts, and
+ the three no-rows outcomes read differently: a failed fetch offers a retry that
+ refetches, an upstream reporting nothing says so, and a search with no match
+ offers to clear itself.
- **`/exchanges`** — top exchanges by trust score and 24h volume (USD, derived
from the live BTC price). New `/api/coin/exchanges`. Each row opens an
[exchange detail page](#exchangeid--exchange-detail).
diff --git a/src/categories.js b/src/categories.js
index faeb86b43..2aff074e0 100644
--- a/src/categories.js
+++ b/src/categories.js
@@ -108,6 +108,7 @@ const state = {
query: '',
shown: PAGE_SIZE,
status: 'loading', // loading | ready | error
+ errorStatus: 0,
};
function pctCell(v) {
@@ -170,8 +171,17 @@ function renderPlaceholder(el) {
return true;
}
if (state.status === 'error') {
- el.innerHTML =
- '<div class="cv-empty">Category data could not be loaded. The market data provider did not answer. <button type="button" class="cv-linkbtn" data-act="retry">Try again</button>.</div>';
+ // A 429 is our own per-IP budget, not an upstream outage, and telling the
+ // user to retry immediately would only spend the next token they have.
+ const why =
+ state.errorStatus === 429
+ ? 'You have requested this feed too many times in a row. Give it a minute, then'
+ : 'The market data provider did not answer.';
+ const how =
+ state.errorStatus === 429
+ ? '<button type="button" class="cv-linkbtn" data-act="retry">load it again</button>.'
+ : '<button type="button" class="cv-linkbtn" data-act="retry">Try again</button>.';
+ el.innerHTML = `<div class="cv-empty">Category data could not be loaded. ${why} ${how}</div>`;
return true;
}
if (!state.categories.length) {
@@ -339,10 +349,12 @@ async function loadCategories() {
// The endpoint returns market-cap-desc order; that ordinal is the rank.
state.categories = (categories || []).map((c, i) => ({ ...c, rank: i + 1 }));
state.status = 'ready';
+ state.errorStatus = 0;
$('cat-updated').textContent = `Updated ${new Date().toLocaleTimeString('en-US')}`;
- } catch {
+ } catch (err) {
state.categories = [];
state.status = 'error';
+ state.errorStatus = err?.status || 0;
$('cat-updated').textContent = '';
}
const search = $('cat-search');