Closed MrSpiffyClean closed 4 years ago
Can reproduce the issue with US, so I'm assuming that it affects every region.
Thinking a bit, and not finding any specific error in code, this might be related to the issue where the selected coutries list is changed after the event firing, which if it is the case, I may not be able to solve easily.
The fix I think can work is treating any change in list of countries as a change of region, so changing the event handler for the Select Parameter should solve this.
The fix works, in that the urlbar no longer shows select
after the steps, but it also doesn't correct itself with the now selected countries. Need a fresh set of eyes to do this.
Adding a createURLFromChange call at the end of processData, and shifting some things in the createURL method seems to fix most of this, with one exception: selecting all then passing to the reported deaths ends up creating a large url, but that is equal to a select=all
.
Looking further, changing the Parameter (in the selectbox) doesn't seem to change the selectedCountries
array, which explains a bit on why select=all
isn't being replaced. This is however something by design, so again, unsure on how to proceed.
Adding a third check in the all/nothing part of the createURL might solve the issue. The countries
array is changed for the selection, but the selectedCountries
stay the same (I think because of ease of comparing one parameter with another?). So, check if all of the elements in countries
are in SelectedCountries, if so, change the URL to select=all
and be done with it.
Interesting behaviour when changing parameters (verifiable on live page). Change parameters to Reported Deaths, then US, then Reported Cases, then World, then US again and the list of default countries ends up changing (e.g. Louisiana), I believe due to the way the countries/locations are pulled from region selection.
Steps to reproduce:
What should be the result:
?region=Canada
, and the countries should be all of them (as there are only 9, so they autoselect)What happens:
?region=Canada&select=all
but the countries are just the 4 that have reported deaths.