firebase/geoFire — pull request #12 by mikepugh (2014-03-27 01:33:51+00:00)
Title: (bug) onPointsNearLoc returns too many results

Within the searchRadius function, a closure was created around the matchesFiltered array. If setAlert is true, the resultHandler is invoked multiple times and continues to push the same results (and any new results) into the matchesFiltered array. Therefore, if the original query returned 3 results and 1 new object is added to the forge, the query would return 7 data points. The original 3, twice, plus the new data point. Fixed by clearing out the matchesFiltered array within each call to resultHandler.