Attachments Filters
The Attachments Filters in Replyke allows developers to filter entities based on the presence or absence of attachments content. This functionality provides a straightforward way to include or exclude entities that contain attachments, ensuring the entity list aligns with your application’s needs.Overview of Attachments Filters
TheattachmentsFilters
property can be passed to the fetchEntities
function as part of the filters object with the following structure:
hasAttachments
: A boolean flag to include or exclude entities based on whether they contain attachments (true
) or not (false
).
Applying Attachments Filters
Developers can apply attachments filters by calling thefetchEntities
function with the desired filter configuration.
How Attachments Filters Work
Attachments Filters are applied on the backend when querying entities. ThehasAttachments
flag works as follows:
true
: Includes only entities that have attachments (e.g., non-empty attachment arrays).false
: Includes only entities that do not have attachments (e.g., empty attachments arrays).null
: Clears the attachments filter, meaning no filtering is applied based on attachments presence.
Example Use Cases
1. Passing Static Filters to the EntityListProvider
To set static filters for attachments presence at the initialization of the entity list, pass them directly to theEntityListProvider
:
2. Dynamically Updating Filters Based on User Interaction
You can also dynamically adjust the attachments filters based on user actions, such as clicking a toggle button:Important Notes
- Attachments Filters operate on the presence of attachments content in entities, typically represented by non-empty or empty attachments arrays.
- Filters are applied immediately, and the entity list resets to reflect the updated conditions.
- Passing
null
toattachmentsFilters
infetchEntities
clears all attachments-based filtering.