0

I have one stream listening changes from a table in supabase, insert and update operations works fine, when occurs one change the stream on flutter listen and re draw the widget but if I delete one row in the database or through the app the stream not listen.

This is the code of stream that listen on flutter.

    Stream<List<Map<String, dynamic>>> response = clientSupabase
    .from('PollSongs:id_pub=eq.$id')
    .stream(['id'])
    .order('likes', ascending: false)
    .execute();

I try without filter just using .from('PollSongs') and the same code and all operation works fine insert, update, and delete.

Stream<List<Map<String, dynamic>>> response = clientSupabase
.from('PollSongs')
.stream(['id'])
.order('likes', ascending: false)
.execute();
Ken White
  • 123,280
  • 14
  • 225
  • 444

1 Answers1

1

Apologies for not documenting this on the stream() section, but could you try running the following SQL and see if it fixes it?

alter table "PollSongs" replica identity full;

You can read more about this configuration here in the official docs. https://supabase.com/docs/reference/javascript/subscribe#listening-to-deletes

dshukertjr
  • 15,244
  • 11
  • 57
  • 94
  • 1
    Thx bro, i run the sql sentence and prove again with the filter and now all operations works fine. – Ivan Gustin May 20 '22 at 20:24
  • @dshukertjr what does this command specifically do? I am also having this issue and have been unsuccessful. – Alex Rabin Sep 15 '22 at 04:40
  • @AlexRabin I have edited my response to include a link to the official Supabase docs, which includes the SQL script that I have in this answer. Are you having trouble receiving delete events, or trouble receiving realtime events as a whole? – dshukertjr Sep 15 '22 at 05:33
  • @dshukertjr thank you, I am just having trouble receiving delete events on a specific row with stream. – Alex Rabin Sep 15 '22 at 14:38
  • @AlexRabin What version of supabase-flutter are you using? If you are willing to use a developer preview version, I think things should be working fine with the latest 1.0.0-dev.7 version of supabase-flutter! – dshukertjr Sep 15 '22 at 14:58
  • @dshukertjr I am using 0.3.3. I’ll try the 1.0.0-dev.7 and get back to you. – Alex Rabin Sep 15 '22 at 15:25
  • @dshukertjr No success with 1.0.0 :( – Alex Rabin Sep 16 '22 at 01:04
  • 1
    @AlexRabin Hmm, in that case the cause might be on the server side. Could you email support@supabase.io with your project reference so that we can take a look at your Supabase instance? – dshukertjr Sep 16 '22 at 02:17
  • @AlexRabin Same behaviour here... Have you opened a ticket on https://github.com/supabase/supabase/issues yet? – Benjamin Corben Sep 16 '22 at 15:05
  • 1
    @BenjaminCorben I reached out to the team as dshukertjr suggested and the supabase team informed me it was an infrastructure issue with my project, they fixed it on their end. Try sending them an email at support@supabase.io – Alex Rabin Sep 20 '22 at 00:37