school-finder
school-finder copied to clipboard
clicking map control for nearby schools reloads nearby schools unnecessarily
We're re-querying unnecessarily
To see it, search for a school (e.g. Darlinghurst Public) and clear your console. No nearby schools are shown.
![screen shot 2016-11-01 at 9 19 01 pm](https://cloud.githubusercontent.com/assets/1072292/19916615/f5c6f61e-a078-11e6-9fe8-7346f5b16306.png)
Click to expand the nearby schools control. You'll see a query in the console. That's fine, since it's checking the 'show nearby schools' checkbox for you.
![screen shot 2016-11-01 at 9 19 09 pm](https://cloud.githubusercontent.com/assets/1072292/19916616/f9eaed40-a078-11e6-8cc6-eef69b788207.png)
Click to collapse the nearby schools control. This shouldn't do reload the nearby schools since they've already been loaded and the user hasn't un-checked the 'show nearby schools' checkbox, but you will notice a new SELECT query in the console.
![screen shot 2016-11-01 at 9 19 16 pm](https://cloud.githubusercontent.com/assets/1072292/19916617/fde92970-a078-11e6-99b2-bf15c875ead0.png)
In addition to running queries when we don't need to, the map unloads and loads the set of nearby schools, so you notice them flicker on the map.