Open B0yma opened 10 months ago
up
This is the expected behavior currently.
Because you have set the RLS so that some_int
less than 1 is not readable, the update on step 5 is not readable from the client.
We are going to need to wait for the fix on the server side for events like this to be sent to the client. Related https://github.com/supabase/walrus/issues/64
Bug report
Describe the bug
Unexpected behavior in flutter android app. in some cases realtime events on update not fired. in some cases fired with wrong data
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
create table with rls policy
put rows with some_int - [0, 1, 2]
run flutter app with your secrets
class MyApp extends StatelessWidget {
final Supabase supabase; const MyApp( {super.key, required this.supabase});
@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: StreamBuilder<List>(
stream: getSomeInts(),
initialData: const [],
builder: (context, snapshot) {
return const FlutterLogo();
}
)
);
}
Stream<List> getSomeInts() {
return supabase.client.from('test').stream(primaryKey: ['id']).map((event) {
log("event.toString():$event");
return event.map((e) => e['some_int'] as int).toList();
});
}
}
event.toString():[{id: 2, some_int: 1}, {id: 3, some_int: 2}]
event.toString():[{id: 2, some_int: 1}, {id: 3, some_int: 2}, {id: 1, some_int: 3}]
event.toString():[{id: 2, some_int: 3}, {id: 3, some_int: 2}, {id: 1, some_int: 3}]