From 3926267d77ee2fc6363976ab3e5e2cd341b12c79 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Mon, 17 Apr 2023 19:13:28 +1000 Subject: [PATCH] Fixed setIsLoadingPokemons calling in fetchPokemonsInRegion --- src/features/Pokedex/pokedexSlice.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/features/Pokedex/pokedexSlice.ts b/src/features/Pokedex/pokedexSlice.ts index 45b1f69..b6d82b2 100644 --- a/src/features/Pokedex/pokedexSlice.ts +++ b/src/features/Pokedex/pokedexSlice.ts @@ -19,6 +19,8 @@ export const fetchPokemonsInTheRegion = createAsyncThunk< const { dispatch, getState } = thunkAPI; const regionOptions = getState().pokedex.regionOptions; + dispatch(setIsLoadingPokemons(true)); + const { startId, endId } = getStartAndEndIdsForRegion(region, regionOptions); const pokemonIds = Array.from( { length: endId - startId + 1 }, @@ -114,6 +116,7 @@ export const { setRegionOptions, setTypeOptions, setSortOptions, + setIsLoadingPokemons, } = pokedexSlice.actions; export default pokedexSlice.reducer;