Skip to content

Commit 2c81776

Browse files
committed
fix: rejoin channels in edge case
1 parent a069db6 commit 2c81776

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/supabase_flutter/lib/src/supabase_auth.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,21 @@ class SupabaseAuth with WidgetsBindingObserver {
141141

142142
bool cancel = false;
143143
final connectFuture = realtime.conn!.sink.done.then(
144-
(_) {
144+
(_) async {
145145
// Make this connect cancelable so that it does not connect if the
146146
// disconnect took so long that the app is already in background
147147
// again.
148148

149-
// ignore: invalid_use_of_internal_member
150-
if (!cancel) return realtime.connect();
149+
if (!cancel) {
150+
// ignore: invalid_use_of_internal_member
151+
await realtime.connect();
152+
for (final channel in realtime.channels) {
153+
// ignore: invalid_use_of_internal_member
154+
if (channel.isJoined) {
155+
channel.forceRejoin();
156+
}
157+
}
158+
}
151159
},
152160
onError: (error) {},
153161
);

0 commit comments

Comments
 (0)