Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cespare opened this issue Jun 20, 2012 · 0 comments
Open

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

cespare opened this issue Jun 20, 2012 · 0 comments

Comments

@cespare
Copy link

cespare commented Jun 20, 2012

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant