From 4e00e3cad84d0ea4af64d551f4e886e2ff0b90d8 Mon Sep 17 00:00:00 2001 From: Julian Tabel Date: Mon, 9 Feb 2026 11:45:29 +0100 Subject: [PATCH] Fix HoF display for transfers/shinies and hook ordering Move alive and hofTeam into useMemo hooks above early returns to fix React hook ordering violation. Include transfer and shiny encounters in alive so they appear in the team section and can be selected for the Hall of Fame. Co-Authored-By: Claude Opus 4.6 --- frontend/src/pages/RunEncounters.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/RunEncounters.tsx b/frontend/src/pages/RunEncounters.tsx index a793dff..fa9e324 100644 --- a/frontend/src/pages/RunEncounters.tsx +++ b/frontend/src/pages/RunEncounters.tsx @@ -620,12 +620,19 @@ export function RunEncounters() { } }, [organizedRoutes, encounterByRoute]) // eslint-disable-line react-hooks/exhaustive-deps + const alive = useMemo( + () => [...normalEncounters, ...transferEncounters, ...shinyEncounters].filter( + (e) => e.status === 'caught' && e.faintLevel === null, + ), + [normalEncounters, transferEncounters, shinyEncounters], + ) + // Resolve HoF team encounters from IDs const hofTeam = useMemo(() => { if (!run?.hofEncounterIds || run.hofEncounterIds.length === 0) return null const idSet = new Set(run.hofEncounterIds) - return normalEncounters.filter((e) => idSet.has(e.id)) - }, [run?.hofEncounterIds, normalEncounters]) + return alive.filter((e) => idSet.has(e.id)) + }, [run?.hofEncounterIds, alive]) if (isLoading || loadingRoutes) { return ( @@ -679,9 +686,6 @@ export function RunEncounters() { } const isActive = run.status === 'active' - const alive = normalEncounters.filter( - (e) => e.status === 'caught' && e.faintLevel === null, - ) const dead = normalEncounters.filter( (e) => e.status === 'caught' && e.faintLevel !== null, )