Add Properties to Auth.User

Hello, for context I'm currently using the svelte-kit auth helper 0.7.1

I know that Supabase suggests creating a public.profiles table to manage additional user data.

However, one thing I'm confused on.

The LayoutServerLoad only pulls back the auth.user as far as I understand. -- I want to grab additional properties like theme so that I can have that user's theme during SSR.

LayoutServerLoad blocks rendering the corresponding svelte layout/page until it completes. Wouldn't hitting the supabase API to grab profiles add to this time to finish?

i.e. I'm looking for a way to grab custom fields/columns from the user without having to make a second trip to the server.

More context, this is essentially what I'm trying to achieve:

export const load: LayoutServerLoad = async ({ locals }) => {
        // locals.session.user <-- Already has user's data.
    return {
        session: locals.session,
        theme: 'night' // <-- Get user's theme from locals.session.user
    };
};
Was this page helpful?