GreenInfo-Network/nyc-crash-mapper

Select area type but not an area = Button selected but no GeoJSON

Closed this issue · 1 comments

When a specific area is selected for filtering, this is preserved properly on page reload:

  • Open the Map and select some area type other than the default, e.g. NYPD Precincts
  • See that the clickable GeoJSON was drawn, and that clicking will select an area
  • Select a specific area, see crash-dots filtered
  • Reload the page
  • See that the same filter is applied: dots are filtered, selected area name/label appear in right-hand sidebar with an X, can be cleared with the X, and so on.

However, when an area type is selected but not a specific area the UI behavior is a bit weird.

  • Open the Map and select some area type other than the default, e.g. NYPD Precincts
  • Reload the page
  • See that the Precinct button is highlighted but it "didn't take"
    • The clickable GeoJSON does not happen, but the button is highlighted
    • One must select a different area type and then re-select this one, in order to cause a change so as to cause the GeoJSON to load

In short:
When loading initial state from URL params, if a geo is given but an identifier is not, the behavior should be as if one had just clicked the geo button, loading the GeoJSON and all.

Example URL:
http://crashmapper.org/#/?cfat=true&cinj=true&endDate=2017-12&geo=nypd_precinct&identifier=&lat=40.70616014451694&lng=-73.977805&lngLats=%255B%255D&mfat=true&minj=true&noInjFat=false&pfat=true&pinj=true&startDate=2017-12&zoom=11