diff --git a/.beans/nuzlocke-tracker-h3fw--use-hof-team-for-genlocke-retirement-instead-of-al.md b/.beans/nuzlocke-tracker-h3fw--use-hof-team-for-genlocke-retirement-instead-of-al.md index 8a4f004..b78bd61 100644 --- a/.beans/nuzlocke-tracker-h3fw--use-hof-team-for-genlocke-retirement-instead-of-al.md +++ b/.beans/nuzlocke-tracker-h3fw--use-hof-team-for-genlocke-retirement-instead-of-al.md @@ -1,11 +1,11 @@ --- # nuzlocke-tracker-h3fw title: Use HoF team for genlocke retirement instead of all alive Pokemon -status: todo +status: in-progress type: task priority: normal created_at: 2026-02-09T09:15:00Z -updated_at: 2026-02-09T09:15:03Z +updated_at: 2026-02-09T09:26:16Z parent: nuzlocke-tracker-8w9s blocking: - nuzlocke-tracker-25mh @@ -36,5 +36,5 @@ select(Encounter.pokemon_id).where( - Update the frontend `RunEncounters.tsx` to also scope `retiredPokemonIds` correctly (no change needed — it reads from the backend response) ## Checklist -- [ ] Update `advance_leg()` to prefer `hof_encounter_ids` over all-alive query -- [ ] Verify backwards compatibility when `hof_encounter_ids` is null \ No newline at end of file +- [x] Update `advance_leg()` to prefer `hof_encounter_ids` over all-alive query +- [x] Verify backwards compatibility when `hof_encounter_ids` is null \ No newline at end of file diff --git a/.beans/nuzlocke-tracker-lqf2--fix-hooks-order-violation-in-runencounters.md b/.beans/nuzlocke-tracker-lqf2--fix-hooks-order-violation-in-runencounters.md new file mode 100644 index 0000000..33d664d --- /dev/null +++ b/.beans/nuzlocke-tracker-lqf2--fix-hooks-order-violation-in-runencounters.md @@ -0,0 +1,11 @@ +--- +# nuzlocke-tracker-lqf2 +title: Fix hooks order violation in RunEncounters +status: completed +type: bug +priority: critical +created_at: 2026-02-09T09:22:14Z +updated_at: 2026-02-09T09:22:58Z +--- + +The hofTeam useMemo was placed after early returns, causing a 'Rendered more hooks than during the previous render' error and blank page. \ No newline at end of file diff --git a/backend/src/app/api/genlockes.py b/backend/src/app/api/genlockes.py index 23ca871..790ef97 100644 --- a/backend/src/app/api/genlockes.py +++ b/backend/src/app/api/genlockes.py @@ -146,16 +146,23 @@ async def advance_leg( # Compute retired Pokemon families if retireHoF is enabled if genlocke.genlocke_rules.get("retireHoF", False): - # Query surviving caught Pokemon from the completed run - # "Surviving HoF" = caught, not fainted, not shiny - survivors_result = await session.execute( - select(Encounter.pokemon_id).where( - Encounter.run_id == current_leg.run_id, - Encounter.status == "caught", - Encounter.faint_level.is_(None), - Encounter.is_shiny.is_(False), + # Prefer the player's HoF team selection; fall back to all alive + if current_run.hof_encounter_ids: + survivors_result = await session.execute( + select(Encounter.pokemon_id).where( + Encounter.id.in_(current_run.hof_encounter_ids), + ) + ) + else: + # Fallback: all surviving caught, non-shiny Pokemon + survivors_result = await session.execute( + select(Encounter.pokemon_id).where( + Encounter.run_id == current_leg.run_id, + Encounter.status == "caught", + Encounter.faint_level.is_(None), + Encounter.is_shiny.is_(False), + ) ) - ) survivor_ids = [row[0] for row in survivors_result] if survivor_ids: