How do I limit records in Supabase Plugin queries and other clarifications

I’m using the Supabase plugin to get some data into the app.

Have a few unclear concepts.

Under Advanced, what do the following two toggle options mean exactly?

  • Fetch this collection automatically
  • Preserve on navigation

Also, how do you limit the amount of records that the query returns?

Hi,

Fetch this collection automatically means we will fetch the collection when a page using this collection is loading. So you don’t even have to add a fetch collection action in an on app/page load workflow. Feel free to uncheck it if you want to control yourself when you want to load this collection for the first time.

Preserve on navigation mean the collection will not be reset or refetch when navigating to another page.

You can limit the amount of records the query returns by configuring the Query configuration step (you don’t have any pagination yet but you can set it with 25 items for exemple, and you will receive only 25 items).

1 Like

Thanks Alexis.

In a page, some of the queries depend on the results of other queries. I guess because of this it’s preferred to not load colections automatically?

Also, Pages link themselves with a different param. I guess that should be a reason to not preserve on navigation?

I think we try to load them in the right order when they depend of each other but yes, you’re better load them manually and to not preserve on navigation in your case :+1:

1 Like

Usually when I coach people about Supabase and WeWeb in our 1:1 sessions, I see this often can be resolved via using joins, which are the biggest power of Supabase, as it’s a PostgreSQL (relational) database. Usually when collections depend on each-other, it rings a bell in my head, and usually you want to use the joins directly in WeWeb (via the Advanced tab for example).

Yeah love joins. In this case the two records are very different than each other and a lot of columns are needed by each so I avoided a join because if i need any change, at this stage there are many, it’ll have to be dropped and recreated. Thanks for the idea @Broberto

1 Like