Skip to content

Commit 3d820c7

Browse files
authored
Merge pull request #190 from FlutterFlow/pinkesh/supabase-streaming-queries
Supabase Streaming Queries
2 parents 03b32a8 + a3fef27 commit 3d820c7

File tree

5 files changed

+66
-11
lines changed

5 files changed

+66
-11
lines changed

docs/ff-integrations/database/supabase/database-actions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ toc_max_heading_level: 5
1010

1111
# Supabase Database Actions
1212

13-
The Supabase Database Actions allow you to **Insert, Update**, or **Delete a Row** from a Supabase table.
13+
The Supabase Database Actions allow you to **Insert, Update**, or **Delete a Row** from a Supabase table.
14+
15+
Note that beyond actions, you can also setup [**Backend Queries**](../../../resources/control-flow/backend-logic/backend-query/backend-query.md) for Supabase. This includes realtime streaming queries.
16+
1417

1518
:::note[Prerequisites]
1619
Before getting started with this section, ensure you have,

docs/resources/control-flow/backend-logic/backend-query/backend-query.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import TabItem from '@theme/TabItem';
1717

1818
We offer you the following types of Backend Queries that you can specify on any widget or page.
1919

20-
* [**Query Collection**](query-collection.md)**:** This query type is used to fetch a single record or a list of
21-
records from a Firestore Collection.
20+
* [**Query Collection or Table**](query-collection.md)**:** This query type is used to fetch a single record or a list of records from a Firestore Collection or Supabase Table.
2221
* [**Document from Reference**](document-from-reference.md)**:** Used to retrieve the details from a document reference.
2322
* [**API Call Query**](api-call-query.md)**:** Used to initiate an API
2423
call.

docs/resources/control-flow/backend-logic/backend-query/query-collection.md

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ tags: [Query Collection, Backend Query, Backend Logic, Control Flow, FlutterFlow
66
sidebar_position: 2
77
keywords: [Query Collection, Backend Query, Backend Logic, Control Flow, FlutterFlow]
88
---
9+
import Tabs from '@theme/Tabs';
10+
import TabItem from '@theme/TabItem';
11+
912
# Query Collection / Table
1013

1114
Quering Firestore Collection or Supabase Table helps you to retrieve a record (or a list of records) automatically whenever a
@@ -38,9 +41,14 @@ backend query:
3841
8. You can also set the **order** in which the documents should be returned, click **+ Order By**
3942
button. Select a **Field Name** to be used for ordering, and choose the **Order** to be
4043
either `Increasing` or `Decreasing`.
41-
9. Click **Save**.
42-
10. If the selected query returns a list of documents and if it's applied to any flexible widget (like `Column`, `Row`, or `ListView`) then FlutterFlow will generate the children widgets
43-
dynamically. A dialog will be displayed with a similar message, click **Ok**.
44+
9. Below are some optional settings that you can configure based on your requirements:
45+
- **Single Time Query**: When this is disabled, the query results will automatically refresh whenever documents or rows are created, updated, or deleted. However, for **Supabase**, this option is enabled by default, meaning the query will run only once. To enable real-time updates, you must turn it off.
46+
- **Ignore Empty Filter Values**: Disabled by default, meaning the query will attempt to find documents with empty text fields if any filter value is empty. When enabled, the query will ignore fields with empty filter values instead.
47+
- **Filter on Null Values**: By default, if any filter value is null, the query will ignore that filter. Enabling this option will include null filters in the query.
48+
- **Enable Infinite Scroll**: To implement infinite scrolling, enable this option and follow the instructions here.
49+
10. Click **Confirm**.
50+
11. If the selected query returns a list of documents and if it's applied to any flexible widget (like `Column`, `Row`, or `ListView`) then FlutterFlow will generate the children widgets
51+
dynamically. A dialog will be displayed with a similar message, click **Confirm**.
4452

4553
:::info
4654
The instructions to query a Supabase table are almost the same, except that for **Query Type**, you should select **Supabase Query**.
@@ -53,7 +61,7 @@ The instructions to query a Supabase table are almost the same, except that for
5361
width: '100%'
5462
}}>
5563
<iframe
56-
src="https://demo.arcade.software/tpt7z1YZLfAogh0eWxUU?embed&show_copy_link=true"
64+
src="https://demo.arcade.software/gnze0w6tZ9INvYmqO6SS?embed&show_copy_link=true"
5765
title=""
5866
style={{
5967
position: 'absolute',
@@ -89,14 +97,42 @@ present inside. Follow the steps below to use the document record data:
8997

9098
You can follow similar steps for using the record data on the other widgets as well.
9199

100+
<Tabs>
101+
<TabItem value="1" label="Display Data from Firestore Collection" default>
92102
<div style={{
93103
position: 'relative',
94104
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
95105
height: 0,
96-
width: '100%'
97-
}}>
106+
width: '100%'}}>
107+
<iframe
108+
src="https://demo.arcade.software/lduCQak3hFCUC1xNVP1c?embed&show_copy_link=true"
109+
title=""
110+
style={{
111+
position: 'absolute',
112+
top: 0,
113+
left: 0,
114+
width: '100%',
115+
height: '100%',
116+
colorScheme: 'light'
117+
}}
118+
frameborder="0"
119+
loading="lazy"
120+
webkitAllowFullScreen
121+
mozAllowFullScreen
122+
allowFullScreen
123+
allow="clipboard-write">
124+
</iframe>
125+
</div>
126+
<p></p>
127+
</TabItem>
128+
<TabItem value="2" label="Display Data from Supabase Table">
129+
<div style={{
130+
position: 'relative',
131+
paddingBottom: 'calc(56.67989417989418% + 41px)', // Keeps the aspect ratio and additional padding
132+
height: 0,
133+
width: '100%'}}>
98134
<iframe
99-
src="https://demo.arcade.software/1EXbONj7gwa3EiQbdDLo?embed&show_copy_link=true"
135+
src="https://demo.arcade.software/utIKpcL7km05zSnZvLaz?embed&show_copy_link=true"
100136
title=""
101137
style={{
102138
position: 'absolute',
@@ -113,4 +149,21 @@ You can follow similar steps for using the record data on the other widgets as w
113149
allowFullScreen
114150
allow="clipboard-write">
115151
</iframe>
116-
</div>
152+
</div>
153+
<p></p>
154+
</TabItem>
155+
</Tabs>
156+
157+
## FAQs
158+
<details>
159+
<summary>Why aren't real-time updates working for my table in Supabase project?</summary>
160+
<p>
161+
First, ensure that the **Single Time Query** option is disabled in the query where you've added it. Then, verify that the real-time feature is enabled for your table in Supabase project. You can find this option in the top-right corner of the table viewer.
162+
163+
![enable-realtime-updates-sb-table.avif](../imgs/enable-realtime-updates-sb-table.avif)
164+
165+
Additionally, you can enable real-time updates when creating a new table.
166+
167+
![enable-realtime-updates-sb-table.avif](../imgs/enable-realtime-updates-sb-table-2.avif)
168+
</p>
169+
</details>

0 commit comments

Comments
 (0)