i feel like im missing something here, since this seems like it should be an easy task. I have a form with an information unique to every user. Once that the user filled out this form (updated his row in Supabase table) is it possible to show these informations as a place holder (or initial value)?
Depending on your use case, you may want to use a different approach with a profile table in the public schema of your Supabase project that is synced to the users table in the auth schema.
It’s a more advanced technique which you can learn about here.
So either way the right approach would be to save all these informations as users metadata - either in a private users table or synced profile table - and then just link to the metadata right?
Mmm not sure there’s a right way. The wrong way would be to have personal data in a table in the public schema with no RLS (or poorly configured RLS) but otherwise, there are different approaches that would work.
For example, if you don’t need any user to be able to access other user’s information (think an HR admin who might need to be able to see an employee’s info), then you probably don’t need a profiles table at all. You could simply store everything in the metadata of the user.
If a big part of your app will be around user data, it might become impractical to store everything in the user metadata field of the users table. You could keep that field to a minimum and store most of the data in a well thought-out profiles table with one column per piece of information (instead of in one big json in the user metadata field of the users table).
first of all thank you for your response, i appreciate it!
And it does make sense for sure:) but lets say i did not want to use users metadata to store this information (since this is quite long and optional after sign-up form). If i have just a normal public table with proper RLS and users ID as a row primary key - what formula could i use in the front end to only display data for the specific logged in user?
For example in this screenshot right here the input will be always displaying “first_name” from “data[0]” for every user - is there a formula how to display “first_name” of logged in user (when im using user ID as primary key for the tables row)?
Hope this makes any sense.
Thank you for your patience:)
Oh, well you should not filter this information in the frontend! You should make sure the backend only returns the data from the current user.
In Supabase, you would add an RLS policy on your profiles table in the public schema so that a SELECT call only returns the info from the current user. It would look something like this: