"in" expression always returns false if needle argument is null #9465
Labels
bug 🐞
needs investigation 🔍
Issues that require further research (e.g. it's not clear whether it's GL JS or something else)
mapbox-gl-js version: 1.9.0
Steps to Trigger Behavior
in
expression that has the needle as null with the haystack as an array containing null - e.g. `['in', null, ["literal", [1,2,3,null,5] ]]Link to Demonstration
https://jsbin.com/qepihirize/edit?js,output
Each circle is a needle of a different type, they should all be black as they are within the haystack.
Expected Behavior
Be able to find
null
within an arrayActual Behavior
in
will always return falseWhen implementing the
index-of
expression (#9443) I noticed thatin
will always return false if the needle isnull
even if the haystack is an array of values that contains a null.The line that is causing this issue is below, it appears that it was changed in #9295 to allow false but still filters out
null
andundefined
and shortcuts to return false.mapbox-gl-js/src/style-spec/expression/definitions/in.js
Line 65 in 0e04a3a
I'd expect
index-of
andin
to work the same way, just so we don't get conflicting answers for the below edge case:I can fix this as part of my PR #9450 but just wanted to confirm that this wasn't another reason why we have this behaviour.
The text was updated successfully, but these errors were encountered: