Skip to content

fix(frontend): stop Alpha Zoo headline rendering the count twice#287

Merged
warren618 merged 1 commit into
mainfrom
fix/alphazoo-count-double-render
Jun 22, 2026
Merged

fix(frontend): stop Alpha Zoo headline rendering the count twice#287
warren618 merged 1 commit into
mainfrom
fix/alphazoo-count-double-render

Conversation

@warren618

Copy link
Copy Markdown
Collaborator

Summary

Fixes #286 — the Alpha Zoo page renders the alpha count twice in its headline (e.g. "456 456 pre-built quant alphas across 4 zoos").

Root cause

frontend/src/pages/AlphaZoo.tsx:218 rendered a standalone {total} and then the translated alphaZoo.prebuiltAlpha string — which already interpolates {{count}}. So the number printed twice. The same line also carried a hardcoded, now-stale 452 fallback.

// before
{total > 0 ? total : 452} {i18n.t("alphaZoo.prebuiltAlpha", { count: total > 0 ? total : 452 })}

Fix

  • Render only the translated string, with the live (filter-aware) total as the count.
  • Drop the hardcoded 452 fallback; while alphas load, show a count-less loading variant gated on the existing loading flag (avoids a "0 pre-built…" flash).
  • New alphaZoo.prebuiltAlphaLoading key added to both en.json and zh-CN.json (locale key sets stay in parity).
// after
{loading
  ? i18n.t("alphaZoo.prebuiltAlphaLoading")
  : i18n.t("alphaZoo.prebuiltAlpha", { count: total })}

Test Plan

  • tsc --noEmit — clean
  • vitest run — 22 files, 209 tests passed
  • Locale key parity verified (no en-only / zh-only keys)

Closes #286

The AlphaZoo headline rendered a standalone `{total}` and then the
translated `prebuiltAlpha` string, which already interpolates
`{{count}}` — so the page showed the number twice (e.g. "456 456
pre-built quant alphas across 4 zoos"). It also carried a hardcoded,
now-stale `452` fallback.

Render only the translated string with the live (filter-aware) total,
and show a count-less loading variant while alphas load. New
`alphaZoo.prebuiltAlphaLoading` key added to both en and zh-CN.
@warren618 warren618 merged commit f059a0d into main Jun 22, 2026
1 check passed
@warren618 warren618 deleted the fix/alphazoo-count-double-render branch June 22, 2026 14:12
warren618 added a commit that referenced this pull request Jun 22, 2026
Live-authorize OAuth fix (#281, closes #259), Alpha Zoo headline
double-count fix (#287, closes #286), and scheduled-research usage
docs (#288). Rolls the 0.1.10 (06-19) entry into the Earlier-news
fold to keep three entries visible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant