Skip to content

fix: huddle lookup resolves by league family, not exact season ID#97

Merged
brandonpham13 merged 1 commit into
mainfrom
fix/huddle-family-lookup
May 13, 2026
Merged

fix: huddle lookup resolves by league family, not exact season ID#97
brandonpham13 merged 1 commit into
mainfrom
fix/huddle-family-lookup

Conversation

@brandonpham13
Copy link
Copy Markdown
Owner

Problem

Switching to a past season caused League Settings, Commissioner panel, and Announcements to appear empty. The huddle stores the leagueId of the season it was linked to (typically the most recent one), but each season in a family has its own leagueId. An exact match only works for that one season.

Fix

New useSelectedLeagueHuddle() hook in useHuddles.ts resolves the family root of both selectedLeagueId and each huddle's leagueId via buildFamilyRootMap, then matches on root instead of raw ID.

  • Fast path: exact match as before (zero extra work for the common case)
  • Slow path: walks the previousLeagueRef chain to find the shared ancestor

Applied to

  • CommissionerPage — replaced local useSelectedLeagueHuddle with the shared hook
  • LeagueSettingsPage — same inline find replaced
  • Announcements widget — same
  • TeamPageselectedLeagueHuddleId for custom awards and trophy control

When switching to a past season, selectedLeagueId changes to that
season's league ID which never matched the huddle (stored with the
most recent season's ID). This caused Settings, Commissioner, and
Announcements to appear empty on any non-current season.

Fix: new useSelectedLeagueHuddle() hook in useHuddles.ts resolves
the family root of both selectedLeagueId and each huddle's leagueId
via buildFamilyRootMap. Fast path: exact match as before. Slow path:
walk the family chain and match on root.

Applied to:
- CommissionerPage (replaced local useSelectedLeagueHuddle)
- LeagueSettingsPage
- Announcements widget
- TeamPage (selectedLeagueHuddleId for awards/trophies)
@vercel
Copy link
Copy Markdown

vercel Bot commented May 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
huddle Ready Ready Preview, Comment May 13, 2026 3:35am

@brandonpham13 brandonpham13 merged commit cf88129 into main May 13, 2026
3 checks passed
@brandonpham13 brandonpham13 deleted the fix/huddle-family-lookup branch May 13, 2026 03:38
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