Hey, I need to fetch collection every 10 sec. In bubble io there is an option to trigger some workflow, in that case i can fetch data after a time delay. But how do i do that i wewb? Loops are a really bad idea i guess?
And is it ok - in terms of cost and performance optimization to do this? I mean i don’t need to run this particular workflow 24/7. Just needed it for a couple of hours thrice a week.
Hi Cheese 
Super interesting question, the way I see it there might be 2 approaches to this:
-
Do the scheduling in Supabase (recommended for true “background” jobs).
You can use Supabase Cron to run a Postgres function or Edge Function on a schedule (e.g. every minute) and write results into a table. In WeWeb you just bind a normal collection or a Database | Select to that table and refresh when needed. This runs even when no one has the app open and gives you better control over costs.
-
Poll from WeWeb with a recurring workflow.
On the frontend you can set up a workflow that re-fetches the collection every X seconds, for example via a timer/loop or a small custom code using setInterval that triggers a “Fetch collection” workflow. This only runs while the user is on the page and can become costly if the interval is too aggressive, so it’s better for temporary “live view” behavior rather than 24/7 jobs.
Given your use case (“a couple of hours, three times a week”), both can work:
If the data needs to be kept in sync regardless of who is online, option 1 (Supabase cron) is safer.
If it only matters while a user is looking at the screen, option 2 with a moderate interval is fine as long as you monitor query volume.
I’m excited to see what other solutions you can think of 
1 Like
Thanks for the reply❤️. Another clarification, if i filter a collection (at the time of creating a collection in the data tab in weweb) does the filtering happens at the backend lvl or does it happens after fetching all the data from the backend. This would be important when fetching data constantly using polling, to save bandwidth. I did a test , where i fetched all the data at one instance and fetch only the filtered data at another and monitored the console. the one with all the records being fetched resulted in 13.2kb but iam not still sure where the filtering occurs
Hey Cheese, smart question!
When using the Supabase plugin as a collection source, filters are applied in Supabase (backend) before the data reaches WeWeb, so you are not downloading the entire table on every request.
1 Like