Skip to content

fix: races page — nav link, detail 404s, table UX improvements#3246

Merged
OAGr merged 5 commits intomainfrom
claude/add-races-to-nav
Mar 26, 2026
Merged

fix: races page — nav link, detail 404s, table UX improvements#3246
OAGr merged 5 commits intomainfrom
claude/add-races-to-nav

Conversation

@OAGr
Copy link
Copy Markdown
Contributor

@OAGr OAGr commented Mar 26, 2026

Summary

  • Add "Races" to Policy nav dropdown (was missing despite full /races feature existing)
  • Fix P0: Race detail pages (/races/[id]) returned 404 on direct navigation — switched to force-dynamic rendering with fetchDetailed for proper error handling instead of misleading 404s
  • Fix AI Angle truncation: Replace max-w-xs truncate with line-clamp-2 + hover tooltip so the most informative column is readable
  • Add expand affordance: Chevron icons (▸/▾) in first column so users discover expandable candidate rows
  • Add Party column to expanded candidate sub-table (was only on detail page)
  • Capitalize party names in expanded rows
  • Show state code for ballot measures: e.g. "(CA)" when no district code exists
  • Replace "Total Races" stat card with "Resolved" — more useful since total = upcoming + active + resolved
  • Clean up source URLs on detail pages — show domain name instead of full raw URL

Also ran production data fixes (not in this PR):

  • Seeded 20 races + 32 candidates to production wiki-server
  • Synced 1,631 entities to production (fixes blank people pages like /people/mike-rogers-mi)

Test plan

  • pnpm build passes
  • pnpm test passes (no races-specific tests to add — pure UI changes)
  • Production wiki-server confirmed to have race data (20 races, 32 candidates)
  • After merge: verify /races renders with data and Races appears in Policy dropdown

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added "Races" link to main navigation under Policy section.
    • Added party affiliation display in candidate details.
    • Added visual chevron indicators for expandable race rows.
  • Bug Fixes

    • Improved error handling on race detail pages with user-friendly messaging.
    • Fixed source URL display to show domain only instead of full URL.
  • UI Improvements

    • Enhanced AI Angle text formatting with better line wrapping.
    • Updated statistics dashboard to display "Resolved" count.

The /races page exists with full data but was missing from the header navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f8342b50-fed1-4750-b06d-18e5813fe659

📥 Commits

Reviewing files that changed from the base of the PR and between 8b8627c and 35c22fd.

📒 Files selected for processing (4)
  • apps/web/src/app/races/[id]/page.tsx
  • apps/web/src/app/races/page.tsx
  • apps/web/src/app/races/races-table.tsx
  • apps/web/src/lib/nav-links.ts

📝 Walkthrough

Walkthrough

Updated the race detail page to use improved data fetching with granular error handling distinguishing between 404 and other failures. Added runtime rendering mode, enhanced source link display, and improved the race listing UI with resolved count metric, expandable rows with chevron indicators, and party column in candidate sub-table. Added Races link to primary navigation.

Changes

Cohort / File(s) Summary
Race Detail Page
apps/web/src/app/races/[id]/page.tsx
Switched from fetchFromWikiServer to fetchDetailed with new error handling: differentiates 404 errors (displays notFound()) from other failures (renders error UI). Added export const dynamic = "force-dynamic" for runtime rendering. Introduced extractSourceDomain() to display compact hostname in source link while preserving full URL href.
Race Listing UI
apps/web/src/app/races/page.tsx, apps/web/src/app/races/races-table.tsx
Replaced "Total Races" stats card with "Resolved" card. Enhanced table with chevron expand/collapse indicators in Race cell, upgraded AI Angle cell to two-line clamp with tooltip, and added new "Party" column to expanded candidates sub-table.
Navigation
apps/web/src/lib/nav-links.ts
Added new Races link under Policy dropdown in navigation menu.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hops through races with glee,
Chevrons dance, the party's clear to see,
Error paths now split just right—
Four-oh-four shines separate from the night,
Navigation blooms with the Races link,
What a hop-tastic change, don't you think? 🌟

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/add-races-to-nav

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 2026

Test Coverage Report

Workspace Lines Branches Functions Statements
wiki-server 50.8% 34.2% 47.2% 49.4%
web 9.5% 7.7% 5.5% 9.4%
discord-bot 39.4% 30.5% 44.1% 38.4%
crux 27.0% 24.2% 30.3% 27.1%
Total 24.9% 18.8% 20.9% 24.6%

Coverage is advisory only — no thresholds enforced. Generated by vitest --coverage.

OAGr and others added 3 commits March 26, 2026 12:27
The total is already obvious from the table. Showing Resolved alongside
Upcoming and Active gives a more useful status breakdown (total = upcoming
+ active + resolved). The API already returns stats.races.resolved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… codes

- Replace max-w-xs truncate on AI Angle column with line-clamp-2 and hover tooltip
- Add ChevronRight/ChevronDown icons as expand affordance on each row
- Add Party column to expanded candidate sub-table with capitalize class
- Show (state) fallback for ballot measures that lack district codes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Switch from fetchFromWikiServer to fetchDetailed for proper error
  discrimination: true 404s (race not found) still trigger notFound(),
  but connection errors and server failures show a user-friendly message
  instead of a misleading 404
- Add dynamic = "force-dynamic" so Next.js does not attempt to
  statically generate these wiki-server-dependent pages during build
- Extract domain from source URLs for compact display (e.g.,
  "prospect.org" instead of the full URL) while keeping full URL as href

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@OAGr OAGr changed the title feat: add Races to Policy nav dropdown fix: races page — nav link, detail 404s, table UX improvements Mar 26, 2026
revalidate is ignored when dynamic = "force-dynamic". The fetch-level
revalidate: 300 in the fetchDetailed call handles caching correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@OAGr OAGr marked this pull request as ready for review March 26, 2026 17:54
@OAGr OAGr added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit 5244835 Mar 26, 2026
22 of 23 checks passed
@OAGr OAGr deleted the claude/add-races-to-nav branch March 26, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant