79498738

Date: 2025-03-10 17:37:23
Score: 1.5
Natty:
Report link

I found the answer:

In my example I referenced 'workIdFilter' but didn't show its definition because it didn't matter, or shouldn't have mattered. Here it is:

let workIdFilter: MapboxMaps.Expression = Exp(.not) {
    Exp(.inExpression) {
        Exp(.get) { "WorkId" }
        Array(hiddenWorkIds)
    }
}

What I'm trying to do here is hide features where the property "WorkId" is contained in the array "hiddenWorkIds".

And here's the problem - when "hiddenWorkIds" is an empty array, it doesn't work right. I can't tell exactly what is happening but I'm guessing there's some error internally that is causing the whole expression to fail and therefore not hide anything.

The workaround is pretty simple -- I just put some dummy value into the array to make sure it is never empty.

This seems like a bug to me. Surely .inExpression should accept an empty list and behave as expected?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
Posted by: Flarosa