I'm using the <Execute> component provided b...
# gooddata-ui
I'm using the <Execute> component provided by @gooddata/sdk-ui. It seems to work correctly if I don't provide any
properties. However, if I provide a filter with an empty array it gives me a strange error
Copy code
const facilityFilter = newPositiveAttributeFilter(MD.FacilityId, []);  // empty filter
return (
The strangest part is that it has this
Oops, simulated error! Retry?
message from the GD components. I thought an empty filter array would just be ignored. What's happening here?
Disregard the red error message, that was just me copy pasting stuff
The actual error I'm still confused about
Hi Levi, thanks for reporting this. We’ll look into the error and let you know if this is as expected or not. But if I may ask, is there a use case that would require an empty
array, on your end? At this point, not providing the property at all is a good way of avoiding the error, as you mentioned.
There is no requirement to use an empty array. Its is mostly to avoid silly logic blocks like:
Copy code
Hey there Levi - I think the assumption that an empty filter would be ignored makes sense, but let me double-check and worst case we can raise this as product feedback 🙂
Hi Levi, I tried to reproduce, but for me, providing an empty filter actually just ignores the filter - to verify, what SDK version are you on? And what import are you using for the newPositiveAttributeFilter?
For the <Excecute> component, we are importing that from @gooddata/sdk-ui 9.0.0
So I was able to replicate this - somehow, in 8.12, the empty filter is ignored properly, but 9+ shows the error instead. I'll raise this with our engineers and keep you updated! 🙂
👍 1
Hey there Levi, the devs have noted that this is correct behaviour of empty positive filter - if you want to add a filter which is ignored when empty, you should use a negativeAttributeFilter. This will then behave as an ALL filter without effect on execution. So there was indeed an issue with how this works, but the other way around - a positiveAttributeFilter shouldn't have been working with an empty filter, and that has been fixed so that it now doesn't work, but a negativeAttributeFilter should do the trick :)
👍 1
Thanks for getting back to me