Edoruin commited on
Commit
4d00d4a
·
1 Parent(s): 0368899

debug: add logs to species loading

Browse files
static/js/components/species-selector.js CHANGED
@@ -108,13 +108,19 @@ const SpeciesSelectorComponent = {
108
 
109
  async init() {
110
  this.selectedSpecies = [];
 
111
 
112
  try {
113
  // Always fetch latest from API to ensure new CSV data is loaded
 
114
  const species = await apiService.getSpecies();
 
 
115
  if (species && species.length > 0) {
 
116
  await dbService.saveSpecies(species);
117
  this.allSpecies = species;
 
118
  return;
119
  }
120
  } catch (error) {
@@ -122,7 +128,9 @@ const SpeciesSelectorComponent = {
122
  }
123
 
124
  // Fallback to local IndexedDB if API fails or is empty
 
125
  this.allSpecies = await dbService.getAllSpecies();
 
126
  },
127
 
128
  toggleSpecies(speciesId) {
 
108
 
109
  async init() {
110
  this.selectedSpecies = [];
111
+ console.log('SpeciesSelectorComponent.init() called');
112
 
113
  try {
114
  // Always fetch latest from API to ensure new CSV data is loaded
115
+ console.log('Fetching species from API...');
116
  const species = await apiService.getSpecies();
117
+ console.log('API returned species count:', species ? species.length : 0);
118
+
119
  if (species && species.length > 0) {
120
+ console.log('Saving species to IndexedDB...');
121
  await dbService.saveSpecies(species);
122
  this.allSpecies = species;
123
+ console.log('allSpecies updated from API');
124
  return;
125
  }
126
  } catch (error) {
 
128
  }
129
 
130
  // Fallback to local IndexedDB if API fails or is empty
131
+ console.log('Falling back to IndexedDB...');
132
  this.allSpecies = await dbService.getAllSpecies();
133
+ console.log('allSpecies updated from DB, count:', this.allSpecies.length);
134
  },
135
 
136
  toggleSpecies(speciesId) {