I have moved on from using setFilter() and now do all of my filtering using JSON with SQL queries.
https://docs.retool.com/docs/querying-via-sql
I use a query to get all of my records as you normally would (say qryPossibleVenues).
Then I create a JSON with SQL query can call it something like qryPossibleVenues_Filtered and use that as the source for my table.
You can then do pretty standard Where clauses to do you filtering
select * from {{qryPossibleVenues.data}}
where (({{selFilterLeg.value || null}} IS NULL OR leg={{selFilterLeg.value}}) OR ({{selFilterLeg.value || -1}} = -1 AND leg is null))
AND ({{selFilterStatus.value || null}} IS NULL OR status={{selFilterStatus.value}})
AND ({{txtFilterVenue.value || null}} IS NULL OR name like {{'%' + txtFilterVenue.value + '%'}})
AND ({{swHideDeadVenues.value || false}} = false or not status=5)
This is easier to program, easier to reason with and you can do almost any kind of filtering you can imagine.
The only gotcha is you need to make sure your source query is an Array of Objects so depending on where you get your data from you may need to do
select * from {{formatDataAsArray(qryPossibleVenues.data)}}
Or add this to your source query's transformer (which I usually do)
