-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
2nd queryRenderedFeatures request fails in a click event #3167
Comments
Can you set up a JSFiddle with a minimal test case? |
@mourner here you go: https://jsfiddle.net/gyfsh02x/ I have created a new style by cloning Just copy the code on your local and try to run on a latest chrome. |
@anvarik by |
@peterqliu this is just dummy code, in my code I have dynamic filters. The problem is not at the filter, 2nd call to |
@anvarik So that JSFiddle doesn't demonstrate the issue you're reporting, right? There's no |
@jfirebaugh - apologies, I forgot that I am working on a latest standalone build on my local, and on jsfiddle I added the cdn. Somehow couldn't manage to add the standalone js to fiddle, so created a plunker with the failure: http://plnkr.co/edit/JVx2Pj not sure whether it would qualify as a bug though, since I build from the latest source, but still it is blocking me developing my app. I can't use v0.23.0 build since I need #3079 fix |
I have the same problem, and here is a JSFiddle with a demonstration using v0.24.0. https://jsfiddle.net/aLbezahv/1/ Clicking a point sets a filter on the second layer. Works first time. Click another point and it fails and throws the Interestingly, this example code is a near duplication of the Highlight features under the mouse pointer example, which works just fine. |
@nate-at-niche can you try the master version? This may have been fixed recently. |
It does not work with the master version either. Specific steps to reproduce:
|
I'm also running in to this issue. It seems to only affect 'vector' sources. Example code based on a GeoJSON source still works. (https://www.mapbox.com/mapbox-gl-js/example/hover-styles/). when modified to use a PBF source, the issue is encountered. As far as I can tell, in the second query, the 'rawTileData' is null, while in the first one, it's not. |
Here is another (much simpler) JSFiddle demonstrating it. https://jsfiddle.net/61LLcow4/ To see error:
It's worth noting that the error does not occur if the query returns nothing. In my example, try moving the top left corner away from a shield and you will not see the error. |
Additionally, the error is still present in version 0.23 (https://jsfiddle.net/2qob4zgh/3/) |
Thank you for the test case @nate-at-niche. It was instrumental in diagnosing the bug. Good news! This bug was fixed already fixed by #3233, which has merged into |
I am testing this on the latest standalone build
How to reproduce
queryRenderedFeatures
and asetFilter
Cannot read property 'feature' of undefined
Here is a pseudo, note that
myLayer
is created in Mapbox Studio, if I create it with mapbox-gl-js error is not thrown. Also, first click event is successful and filter is set andfeatures
has value, however in the second click the code fails inqueryRenderedFeatures
function, don't even reach to the filterThe text was updated successfully, but these errors were encountered: