Hi, can someone explain to me when to use fetch collection with supabase real-time? Even without real-time I am still confused when to use fetch collection. If not real time, do I have to fetch everytime I update/add to database? When use real-time when do I use the fetch method?
Hi Kkairul,
WeWeb create web sockets through Supabase library. So when there is a change on Supabase, it’s immediately push to WeWeb. You don’t need to fetch the collection
Hi @Mael,
I configured WeWeb and Supabase, but I need to click on reload to get latest data from database
I used grid to show data from real-time data table
Do I need to publish app to avail this functionality?
Hello,
You don’t need to publish to use realtime table from supabase. Did you set the table to realtime in WeWeb and Supabase?
You can have a look to our documentation about it here: Supabase data source | Weweb documentation
Hi @Mael,
Is this (automatic updates to a collection a user is subscribed to, with Supabase Realtime on) suppose to be the case currently?
I worked on this today, following the docs, and it seems like I have to do a page level workflow with a “Fetch collection in parallel” action to actually update the collections.
The docs are a little unclear though, specifically around listening for database changes. The example used (of updating a variable) in the docs doesn’t address collections. Using the above ‘Fetch in parallel’ works for now, while I am developing, but surely it is not efficient to refetch the entire collection(s). Is there a better way here?
I looked at the “Update collection” action, but it seems to require us knowing/setting exactly what needs to be updated (verse parsing the updates Supabase realtime returns).
Am I missing something, or is refetching the entire collection on a Supabase realtime trigger the best option?
Thanks
Keep doing this way if those collections have filtering you need. The issue with the “proper” way is it doesn’t respect the collection filtering so it just shows all updates. Pretty much useless in most cases we use realtime, we do the same as you.
It doesn’t even seem to respect the filter you use on the subscription, we still see inserts for stuff we shouldn’t even though our filtering on our realtime subscription is the same as the collection