From 482bbdd9a01c4444e9a6d91250e4a79cdd49fdad Mon Sep 17 00:00:00 2001 From: njrini99-code Date: Wed, 1 Jul 2026 12:52:00 -0400 Subject: [PATCH] fix(baseball): clear Events loading state when coach has zero teams (#444) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EventsClient initialized `loading` to true but only ran fetchEvents() when teams.length > 0. A showcase coach with no teams never cleared loading, so the Events page was stuck on a skeleton forever with a "Loading…" subtitle. Add an else branch: when auth is ready (authLoading === false) and the coach has no teams, reset events to [] and set loading false so the page falls through to the existing honest empty state. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_017VUauUXsm9aXegShmpJi5n --- .../baseball/(dashboard)/dashboard/events/EventsClient.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/baseball/(dashboard)/dashboard/events/EventsClient.tsx b/src/app/baseball/(dashboard)/dashboard/events/EventsClient.tsx index 40688ac51..a2052b1cc 100644 --- a/src/app/baseball/(dashboard)/dashboard/events/EventsClient.tsx +++ b/src/app/baseball/(dashboard)/dashboard/events/EventsClient.tsx @@ -171,6 +171,12 @@ export default function EventsPage() { if (teams.length > 0) { fetchEvents(); + } else if (!authLoading) { + // Auth is ready but the coach has no teams (e.g. a new showcase org): + // clear the skeleton and fall through to the honest empty state instead + // of spinning on `loading` forever. + setEvents([]); + setLoading(false); } }, [authLoading, coach?.id, teams]);