From 5cd95cf78ff5e964e68dd566a7791bedb046d404 Mon Sep 17 00:00:00 2001
From: Liam
Date: Mon, 15 Jun 2026 06:28:17 +0000
Subject: [PATCH] =?UTF-8?q?Fix=20battle-logs=20returning=200=20results=20?=
=?UTF-8?q?=E2=80=94=20replace=20SQB=20field=20names=20with=20TSS=20name?=
=?UTF-8?q?=20field?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
bestTeamName and canonicalTeamName were checking tag_name/short_name/long_name
(SQB API fields) which don't exist on TSS team objects. Every team resolved to
an empty string so fetchRecentTssGames bailed out immediately with no matches.
Also clean up all other references to those dead fields throughout the component.
Co-Authored-By: Claude Sonnet 4.6
---
frontend/src/App.jsx | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 189c631..1f22c0d 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -104,7 +104,7 @@ function formatDate(timestamp) {
}
function bestTeamName(team) {
- return team?.tag_name || team?.short_name || team?.long_name || ''
+ return team?.name || ''
}
function teamDetailLooksReal(detail) {
@@ -125,7 +125,7 @@ function teamDetailLooksReal(detail) {
}
function canonicalTeamName(detail, fallback = '') {
- return detail?.tag_name || detail?.short_name || detail?.long_name || fallback
+ return detail?.name || fallback
}
function normalizeAnalyticsPreferences(value) {
@@ -564,8 +564,7 @@ async function fetchRecentTssGames(teams, signal) {
bySession.set(game.session_id, {
...game,
- team_name: data.tag_name || name,
- long_name: data.long_name || '',
+ team_name: data.name || name,
})
})
})
@@ -1067,8 +1066,8 @@ function AppContent() {
const results = (data.teams || data.results || [])
.map((team) => ({
name: bestTeamName(team),
- detail: team.long_name || team.short_name || '',
- aliases: [team.tag_name, team.short_name, team.long_name].filter(Boolean),
+ detail: '',
+ aliases: [team.name].filter(Boolean),
}))
.filter((team) => team.name)
.slice(0, 10)
@@ -1079,8 +1078,8 @@ function AppContent() {
if (!controller.signal.aborted) {
fetchJson(apiEndpoints.resolve(query), controller.signal)
.then((data) => {
- const name = data.tag_name || data.short_name || data.long_name || ''
- setTeamSearchResults(name ? [{ name, detail: data.long_name || data.short_name || '', aliases: [name] }] : [])
+ const name = data.name || ''
+ setTeamSearchResults(name ? [{ name, detail: '', aliases: [name] }] : [])
setSearchHint(name ? { status: 'ready', name } : { status: 'error', name: '' })
})
.catch(() => {
@@ -1440,8 +1439,8 @@ function AppContent() {
return teams
.map((team) => {
const name = bestTeamName(team)
- const aliases = [team.tag_name, team.short_name, team.long_name].filter(Boolean)
- return { name, detail: team.long_name || team.short_name || '', aliases }
+ const aliases = [team.name].filter(Boolean)
+ return { name, detail: '', aliases }
})
.filter(({ name, aliases }) => {
if (!name || seen.has(name)) return false
@@ -1466,7 +1465,7 @@ function AppContent() {
try {
const resolved = await fetchJson(apiEndpoints.resolve(name))
- const resolvedName = resolved.tag_name || resolved.short_name || resolved.long_name
+ const resolvedName = resolved.name
if (!resolvedName) throw new Error('Team not found')
const detail = await fetchJson(apiEndpoints.detail(resolvedName))
@@ -2846,9 +2845,6 @@ function TeamsPage({ leaderboard, navigate, teams }) {
#{index + 1}
{name}
-
- {team.long_name || team.short_name || 'Unresolved'}
-
{formatNumber(team.player_count)} players
{formatNumber(team.total_battles)} battles
@@ -2879,8 +2875,7 @@ function TeamProfilePage({ navigate, profile, requestedTeam, teams }) {
const ratingHourly = profile.history.data?.rating_hourly || []
const latestRating = ratingHourly.at(-1)?.rating || summary?.points?.total_points
const leaderboardTeam = teams.find((team) => bestTeamName(team) === requestedTeam)
- const displayName = detail?.tag_name || bestTeamName(leaderboardTeam) || requestedTeam
- const longName = detail?.long_name || leaderboardTeam?.long_name || ''
+ const displayName = detail?.name || bestTeamName(leaderboardTeam) || requestedTeam
return (
@@ -2900,7 +2895,7 @@ function TeamProfilePage({ navigate, profile, requestedTeam, teams }) {
{displayName}
- {profile.detail.error || longName || profile.detail.status}
+ {profile.detail.error || ''}
@@ -3090,7 +3085,7 @@ function BattleLogsPage({ live, matches }) {
{match.team_name || 'TSS team'}
-
{match.long_name || 'TSS battle record'}
+
TSS battle record