-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest backend state is not pulled after Supabase login #453
Comments
Were you able to fix it? |
Not yet. I have hard times figuring out a solution that wouldn't feel like bubblegum fix |
@jmeistrich facing the same issue, can you please help? |
Unless I'm misunderstanding, it sounds like you want the supabase sync to wait until the user is authenticated? Because syncing before auth would get incorrect/invalid data? So I think you want the const customSynced = configureSynced(syncedSupabase, {
...,
waitFor: isAuthed$
}) It's (barely) documented here: https://legendapp.com/open-source/state/v3/sync/crud/#all-options. I think I should expand on the purpose of Or am I misunderstanding what you're looking for? |
Yes, this is correct. It would work for me since the user app doesn't have any input to the store before they have to authenticate. I think adding mention of this to supabase part would also be beneficial, as I assume this is quite common problem. |
I am experiencing the same issue while trying to write to the DB as soon as the user signs in. Before writing to the DB, I check if the record already exists (by ID), and if it does exist, I do not write to the DB. Since I write to the DB before the data has been pulled from it, it is rewriting it. How can I wait until the data has loaded from the DB? I have tried this with and without async storage but no luck const syncState$ = syncState(state$)
await when(syncState$.isPersistLoaded) await when(
() => syncState$.isLoaded.get() && syncState$.isPersistLoaded.get()
); Thanks in advance ;) |
I'm creating an app with Expo., with supabase as the backend and authentication service.
I have an issue on existing user logging in, but their data is not pulled from the backend after successful authentication.
Steps to reproduce
I didn't figure out a way to force pull their data from supabase on the step 5. Is there way to manually ask LegendState to fetch whatever backend has?
Here is my integration which is based on LegendState & Supabase documentation. I'm using
plan$.get()
to render.utils/SupaLegend.ts
The text was updated successfully, but these errors were encountered: