Skip to content

Commit

Permalink
fix(species context): remove species count queries (#169)
Browse files Browse the repository at this point in the history
* fix(species context): remove unnecessary get capture count per species http requests

* chore(species context): remove commented function get species list with count
  • Loading branch information
Mloweedgar authored Oct 11, 2021
1 parent b05c4f0 commit 993d566
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/context/SpeciesContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,7 @@ export function SpeciesProvider(props) {

const loadSpeciesList = async (abortController) => {
const species = await api.getSpecies(abortController);
log.debug('load species from api:', species.length);

const speciesListWithCount = await Promise.all(
species.map(async (species) => {
let captureCount = await api.getCaptureCountPerSpecies(
species.id,
abortController,
);
species.captureCount = captureCount?.count;
return species;
}),
);
// console.log('species with count', speciesListWithCount);
setSpeciesList(speciesListWithCount);
setSpeciesList(species);
};

// only used by Species dropdown
Expand Down

0 comments on commit 993d566

Please sign in to comment.