# Client filters, when is the data filtered?

**URL:** <https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698>\
**Category:** Ask the community\
**Tags:** app-data\
**Created:** [September 15, 2023, 12:02pm UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698 "2023-09-15T12:02:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jonas/32/17_2.png) [@Jonas](https://community.appfarm.io/u/Jonas)\
**Post date:** [September 15, 2023, 12:02pm UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698/1 "2023-09-15T12:02:58Z")

</div>

We have started to implement lazy loading throughout our app by setting different client filters based on where the user is in our app. However, we are still experiencing some customers who are getting errors when loading data sources that should be empty, because of what looks like they are getting too much data being loaded into the client.

That made us think about, does the client filter actually filter out what data comes to the client from the database, or is all data still being _read_ to the client, but just filtered out in the UI and in dev tools?

We didn’t find the description of client filters in Create or the documentation that helpful.

---

<div class="post-metadata">

**Author:** ![Joanna](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/joanna/32/122_2.png) [@Joanna](https://community.appfarm.io/u/Joanna)\
**Post date:** [September 19, 2023, 12:29pm UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698/2 "2023-09-19T12:29:55Z")

</div>

Hi @Jonas! Client filters cannot be used for lazy loading, as all data is read from the database to the client, and only then the filter is applied client-side. We’ll have a look at the docs to make this more clear.

---

<div class="post-metadata">

**Author:** ![Jonas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jonas/32/17_2.png) [@Jonas](https://community.appfarm.io/u/Jonas)\
**Post date:** [September 19, 2023, 1:05pm UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698/3 "2023-09-19T13:05:03Z")

</div>

Okay, that was clarifying. Thank you!

Would you say the best solution for implementing lazy loading as of now is to use a runtime data source and read the data on demand?

---

<div class="post-metadata">

**Author:** ![Joanna](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/joanna/32/122_2.png) [@Joanna](https://community.appfarm.io/u/Joanna)\
**Post date:** [September 20, 2023, 8:13am UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698/4 "2023-09-20T08:13:17Z")

</div>

The cleanest strategy would probably be to use the `disabled` tag on your data source, which you toggle to `enabled` when needed.

---

<div class="post-metadata">

**Author:** ![Jonas](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jonas/32/17_2.png) [@Jonas](https://community.appfarm.io/u/Jonas)\
**Post date:** [September 20, 2023, 1:56pm UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698/5 "2023-09-20T13:56:30Z")

</div>

We would definitely need something more granular than that, as we only want to load a set of data in different cases. So we’ll test now to set this up with a runtime datasource and just read objects as we need them.

---

<div class="post-metadata">

**Author:** ![Joanna](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/joanna/32/122_2.png) [@Joanna](https://community.appfarm.io/u/Joanna)\
**Post date:** [September 21, 2023, 8:25am UTC](https://community.appfarm.io/t/client-filters-when-is-the-data-filtered/698/6 "2023-09-21T08:25:15Z")

</div>

In this case, it might be the way to go. Let us know how it goes 🙂
