Update Initial Value on Form Based on Current Logged in User

Hello,

Having some trouble and struggling. I have a Profile Page (as well as an update Profile Page). I have a Users Collection page synced with a public profiles table in Supabase.

I want to display items such as ‘About Me’, ‘Website’, ‘Email’, ‘Name’, etc. on the profile page. When I try to bind the text to that portion of the Users collection - it allows me to display the required information but only for a specific table. It doesn’t allow me to show the specific information based on the current logged in user. Email & Name I can do it by binding to Supabase Auth metadata. But things that live outside of the metadata that are in the Users Collection (like ‘About Me’, Profile Pic, or ‘Website’) I can’t seem to do. Do I need to write a custom formula in JS - hoping I could do it through the WeWeb Formula.

This is the option that displays the current collection item (like collection 2, 3, 4, etc) but it doesn’t update depending on the current logged information.

Have you tried clicking on var to the left of the little data stack icon and then bind those values that are purple, not blue?

But this is actually a great question, I’m a noob in WeWeb (not to development though) so don’t listen to me but would love to hear from @weweb-team on how to accomplish this as I am doing the account/profile pages later this week in our project.

I actually think I figured out the right formula - using a Lookup (see below). Would love if common formulas like this (figure alot of people would only want to show a user’s specific data) were documented somewhere.

WeWeb experts - let me know if there’s a better way or formula.

Ideally you want to have the minimum amount of data in the browser, both for performance and security.
Performance: do you need to fetch all your users? Are you displaying only the data from one user or all of them? This can bring problems as soon as you reach few hundreds users. You can have supabse filter the result for you and send only the relevant user data. Try the filter options when you set up the collection, remember that you can bind dynamic values to variables.
Security: you probably know this already, fetching all the info makes them available to the user in the browser even if you only display one in the page. If there is any data that you want to hide you need to set it up in supabase.

1 Like