Skip to content

Commit 830281b

Browse files
author
Dexter
committed
fix: guard typeLevelSubtitle in router render — was crashing on undefined ref, preventing spotlight activation
1 parent ef91d32 commit 830281b

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

fandom.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,6 @@ <h2>Pick a player</h2>
247247
<!-- Both classic+defer to guarantee document-order execution: data-layer.js runs first
248248
and assigns window.DataLayer; fandom.js runs second and reads it. -->
249249
<script defer src="data-layer.js?v=20260627m6"></script>
250-
<script defer src="fandom.js?v=20260627m7"></script>
250+
<script defer src="fandom.js?v=20260627m8"></script>
251251
</body>
252252
</html>

fandom.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,15 +3611,18 @@
36113611
window.fandomRouter.register('player', {
36123612
render: (payload) => {
36133613
showGraphFor(payload.player);
3614-
// L2 context subtitle — upgraded to mention top whale for per-player identity
3615-
const p = data.players.find(x => x.name === payload.player);
3616-
if (p) {
3617-
const topOwner = currentData && currentData.ownerArr && currentData.ownerArr[0];
3618-
const whaleTag = topOwner ? ` · TOP WHALE ${String(topOwner.name).toUpperCase()} HOLDS ${topOwner.fullHoldings.toLocaleString()}` : '';
3619-
const totalMarketValue = p.editions.reduce((a, e) => a + editionMarketValue(e), 0);
3620-
typeLevelSubtitle(`${String(p.name).toUpperCase()} · ${(p.totalMintedMomentCount || 0).toLocaleString()} MOMENTS · ${p.owners.length.toLocaleString()} COLLECTORS · ${p.editions.length} EDITIONS · EST ${fmtUSDShort(totalMarketValue)} MARKET VALUE${whaleTag}`);
3621-
} else {
3622-
typeLevelSubtitle('');
3614+
// Subtitle is optional — typeLevelSubtitle was removed in the L0/L1 cleanup.
3615+
// Guard so the render function doesn't crash (which would prevent spotlight activation).
3616+
if (typeof typeLevelSubtitle === 'function') {
3617+
const p = data.players.find(x => x.name === payload.player);
3618+
if (p) {
3619+
const topOwner = currentData && currentData.ownerArr && currentData.ownerArr[0];
3620+
const whaleTag = topOwner ? ` · TOP LOCKED ${String(topOwner.name).toUpperCase()} · ${fmtLockedScore(topOwner.lockedScore)}` : '';
3621+
const totalMarketValue = p.editions.reduce((a, e) => a + editionMarketValue(e), 0);
3622+
typeLevelSubtitle(`${String(p.name).toUpperCase()} · ${(p.totalMintedMomentCount || 0).toLocaleString()} MOMENTS · ${(p.lockedLeaderboardCount || p.owners.length).toLocaleString()} LOCKED COLLECTORS · ${p.editions.length} EDITIONS${whaleTag}`);
3623+
} else {
3624+
typeLevelSubtitle('');
3625+
}
36233626
}
36243627
if (payload.spotlight) setTimeout(() => activateSpotlight(payload.spotlight), 1500);
36253628
},

0 commit comments

Comments
 (0)