Fix doubled encounters in encounter modals by filtering on gameId

EncounterModal and ShinyEncounterModal were calling useRoutePokemon
without a gameId, returning encounters for all games in the version
group. Now both receive and pass the run's gameId to scope results
to the current game only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 12:18:12 +01:00
parent 3e88ba50fa
commit da9cf0acd2
4 changed files with 22 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import type { Route, RouteEncounterDetail } from '../types'
interface ShinyEncounterModalProps {
routes: Route[]
gameId: number
onSubmit: (data: {
routeId: number
pokemonId: number
@@ -41,6 +42,7 @@ function groupByMethod(pokemon: RouteEncounterDetail[]): { method: string; pokem
export function ShinyEncounterModal({
routes,
gameId,
onSubmit,
onClose,
isPending,
@@ -48,6 +50,7 @@ export function ShinyEncounterModal({
const [selectedRouteId, setSelectedRouteId] = useState<number | null>(null)
const { data: routePokemon, isLoading: loadingPokemon } = useRoutePokemon(
selectedRouteId,
gameId,
)
const [selectedPokemon, setSelectedPokemon] =