You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @gschaer! I'm here to help you with any bugs, questions, and becoming a contributor. Let's tackle this issue together while we wait for a human maintainer.
To resolve the issue with the region_id being stored as a string in the json/subregions.json file, you should adjust the filterSubregions function in app.js to handle string comparisons instead of converting regionId to an integer. Here's how you can modify the function:
asyncfunctionfilterSubregions(regionId){console.log(typeofregionId);constsubregions=awaitgetFromIndex('subregions','region_id',regionId);// Use regionId as a stringconsole.log(subregions);renderSubregions(subregions);document.querySelector('.countries-tb').innerHTML='';document.querySelector('.states-tb').innerHTML='';document.querySelector('.cities-tb').innerHTML='';}
By using regionId as a string, you ensure that the data types match, allowing the filterSubregions function to correctly retrieve and display the subregions on the demo website [1].
In the json/subregions.json file, the "region_id" is stored as a string instead of an int.
Example:
countries-states-cities-database/json/subregions.json
Line 5 in f03a0aa
This breaks the demo website as the filterSubregions function tries to search for an int in the key (using parseInt)
countries-states-cities-database/docs/js/app.js
Line 107 in f03a0aa
The behavior we see on the demo website is that when selecting a region, no subregions are returned.
The text was updated successfully, but these errors were encountered: