Removed redundant cache clear code
This commit is contained in:
parent
00a8e7cba1
commit
c10c2f2608
@ -24,7 +24,7 @@ export const fetchPokemonsInTheRegion = createAsyncThunk<
|
||||
{ length: endId - startId + 1 },
|
||||
(_, i) => i + startId,
|
||||
);
|
||||
// use pokemonIds to fetch pokemon data using fetch, remember to clear all fetched cache after saving data into store
|
||||
// use pokemonIds to fetch pokemon data using fetch, which won't save the data in the cache
|
||||
const pokemonList = await Promise.all(
|
||||
pokemonIds.map(
|
||||
id =>
|
||||
@ -38,13 +38,6 @@ export const fetchPokemonsInTheRegion = createAsyncThunk<
|
||||
(pokemon: PokemonResponseData) => pokemon,
|
||||
);
|
||||
|
||||
// TODO: Fix this cache clearing, as running it cause proble in browser console
|
||||
// clear all fetched data cache
|
||||
// pokemonIds.forEach(id => {
|
||||
// const cacheKey = `https://pokeapi.co/api/v2/pokemon/${id}`;
|
||||
// delete (window as any).fetch.cache[cacheKey];
|
||||
// });
|
||||
|
||||
return pokemonListData;
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user