You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Supabase realtime for postgres_changes in a webview application on mobile. When I background the app, the client does not receive any events. When I re-enter the app before the socket has timed out, I get all of the events that were sent in the interim all at once.
The problem is the new data for a table is sent to every table's callback, not just the callback for that table. This only happens in the scenario when the app is recovering from being backgrounded and receiving events all at once.
To Reproduce
Try to create a supabase client in the browser, subscribed to multiple tables
Go to the app on a mobile device. Make sure to log the events from each table callback
Background the app (go to home or a different app)
Make some changes to the DB tables
When you re-enter the app, check the logs. The changes you made to the DB tables should be published not only to the callbacks for those tables, but also all of the other callbacks
I just had something similar. I had to put a guard up like this to actually check the table in the payload against the table I had subscribed to:
const channel = client
.channel(tableName)
.on(
'postgres_changes',
{ event: 'UPDATE', schema: '*' },
(payload) => {
if (payload.table !== tableName) {
// only handle if this is the table that we subscribed to
return;
}
// handle the updates
},
)
I haven't had time to drill down into the exact scenario that causes it. It only happens in one place in my app.
Bug report
Describe the bug
I'm using Supabase realtime for
postgres_changes
in a webview application on mobile. When I background the app, the client does not receive any events. When I re-enter the app before the socket has timed out, I get all of the events that were sent in the interim all at once.The problem is the new data for a table is sent to every table's callback, not just the callback for that table. This only happens in the scenario when the app is recovering from being backgrounded and receiving events all at once.
To Reproduce
Expected behavior
I would expect the data for
table1
to only go to the callback for table1Screenshots
These are screenshots of logs from my own application.
System information
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: