'show' event is called with bad data the first time #128

cespare opened this Issue Jun 20, 2012 · 0 comments

1 participant


This one caused me a lot of confusion.

The first time a geoJson tile is needed, before the load callback fires, the show callback fires with a callback parameter e that seems invalid (e.features is an empty array). Immediately after this happens, the load callback fires with the expected feature data in the argument, and when the same tile is shown again subsequently, the show callback is called with the feature data as expected (in my scenario I'm using tile(false)).

This seems like strange and incorrect behavior. I ran into this because I'm using the show event to dynamically style the features, and the styling wasn't working the first time the tile is shown (but did work if I zoomed in/out again to re-show the tile). Furthermore, to fix this behavior I had to attach my styling callback to the load event as well, which doesn't seem like it should be necessary.

IMO the correct behavior would be to fire the show event after the load event, and to pass in the new tile's features to the show callback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment