Include $object from query in list show/hide-if

A list-item of a dynamic list fails to allow for the $object of the query to be included within the show/hide-if.
Given that a condition is defined by a function I require the queried object to be included.

How would this be achieved?


     <list empty-message="Contact Support; No Master Categories Available">
         <list-item query="categories" hide-if="$:hide_shelter_category($object)">
             <accent label="$:countQuestions($object)" color="positive" />
             <action on-press="$:goToCategory($selection)" />
             <asset icon="$:check_completeStatus($object, 'icon')" color="$:check_completeStatus($object, 'colour')" />

Exclude the object from your query instead. If you cannot do that in the DB query directly then get an array instead of a query and apply custom array filter logic to the elements in the array before rendering it in the list.

If your filter is on a related object you may have to cache the related objects before trying to access them in the array.filter function. Similar to this post on custom sorting

As of runtime version 4.84.0 (currently in RC), it is possible to reference $object within the show-if/hide-if attributes of a list-item.

For example, the following list will exclude any users named Adam:

    <list-item query="users" hide-if="$:$ === 'Adam'">