Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

Bug: flags field is missing on RLS-Realtime #74

Closed
Vinzent03 opened this issue Dec 14, 2021 · 13 comments · Fixed by #82
Closed

Bug: flags field is missing on RLS-Realtime #74

Vinzent03 opened this issue Dec 14, 2021 · 13 comments · Fixed by #82

Comments

@Vinzent03
Copy link
Contributor

Vinzent03 commented Dec 14, 2021

See #74 (comment)

@Vinzent03

This comment has been minimized.

@Vinzent03 Vinzent03 changed the title Bug: Replacing existing values in stream on update event Bug: flags field is missing on RLS-Realtime Dec 22, 2021
@Vinzent03
Copy link
Contributor Author

Vinzent03 commented Dec 22, 2021

RLS-Realtime doesn't ship the flags field anymore. supabase/realtime#210 (comment)

So it isn't possible to generate the primaryKeys list. See here. I think we should mark it to be only compatible with old supabase projects, because all new supabase project use RLS-realtime if I understand @w3b6x9 correctly.

The problem is now that stream depends on it to replace existing data. See here. payload.primaryKeys is empty, which causes always the first value in _streamData to be replaced. I think the only way to fix this is that the user has to enter the primary key manually.

@Vinzent03 Vinzent03 reopened this Dec 22, 2021
@JPGarCar
Copy link

Hi @Vinzent03 wondering if this client is using Realtime RLS or the old Realtime implementation, as it seems like Realtime RLS is going to be the default for all supabase projects.

@Vinzent03
Copy link
Contributor Author

@JPGarCar I don't really know what you mean, but this client should work for both systems for backwards compatibility. I don't think there are many changes needed to be rls-realtime compatible. The only issue I experienced is this one.

@Vinzent03
Copy link
Contributor Author

Any updates? I think the stream method is crucial for many apps. I can submit a pr, but I want to make sure my idea of solving this (the user has to enter the primary key manually) is accepted by you.

@nitheshb
Copy link

nitheshb commented Jan 6, 2022

@Vinzent03 the issue of appending changed data to the top of the output still exists even after modifying my table structure to enter primary key column values manually without using any of the default auto gen functions. More over if any of the row deletions is also not being recognized. Please suggest.

@Vinzent03
Copy link
Contributor Author

@nitheshb Sorry but I don't understand what you want to tell me at all. With "the user has to enter the primary key manually" I meant the primary key name has to be given to the stream method as parameter, because that information is not coming from the backend anymore. I should have said dev instead of user, maybe.

@nitheshb
Copy link

nitheshb commented Jan 6, 2022

@Vinzent03 can u please share any syntax on how to pass the key as a parameter to stream. As iam using this over steamBuilder Widget in flutter.

@Vinzent03
Copy link
Contributor Author

@nitheshb

supabase.from('my_table').stream("my_key").execute();

@nitheshb
Copy link

nitheshb commented Jan 8, 2022

@Vinzent03 The above syntax is not valid. As stream method doesn't take any parameters as per version : supabase: ^0.2.10.

Syntax I tried: Supabase.instance.client.from('test').stream("my_key").execute();
Error Msg: Too many position arguments: 0 expected but 1 found .

@Vinzent03
Copy link
Contributor Author

I said

I can submit a pr, but I want to make sure my idea of solving this (the user has to enter the primary key manually) is accepted by you.

and this issue is still open, so it's not fixed. You asked for a syntax example. It's just a proposal to fix this issue. That parameter doesn't exist, because it's the way I would solve this issue, but I don't want to submit a pr if the supabase-comunity devs don't like that way of solving the missing information about primary keys.

@nitheshb
Copy link

nitheshb commented Jan 8, 2022

Thank you I got it.it make sense. Sorry for my ignorance.

@dshukertjr
Copy link
Member

So sorry for coming in late. Had been dealing with some personal issues lately.

@Vinzent03

Any updates? I think the stream method is crucial for many apps. I can submit a pr, but I want to make sure my idea of solving this (the user has to enter the primary key manually) is accepted by you.

I was thinking how we can solve this, and I love this route.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants