<@!107176742342402048> hi sorry for pinging, I hav...
# javascript
b
@User hi sorry for pinging, I have an issue with your updated code for sveltekit supabase auth. in my`onAuthStateChange` function,
session.set
throws the error
Error: Cannot set session store before subscribing
. Do you perhaps know why this could happen? before the breaking update this wasn't an issue
s
I make sure I call the session store in my template so that it gets automatically subscribed to before I use it. You can see the example here https://github.com/silentworks/waiting-list/blob/main/src/routes/__layout.svelte#L28
b
ahh
then just a
console.log($session)
would fix it right?
my
__layouts.svelte
is here https://github.com/rmrt1n/cybernaut-2/blob/main/src/routes/__layout.svelte, i took the session items i needed from the load function, should i just assign $session to another variable or is that bad practice
s
You shouldn't need to reassign the $session as this is a global store and the one in the load function is a parameter that is scoped to the load function
I wouldn't console log it either as you don't really want to leave that in your production code. Calling it like I did in my template is probably the better way to go.
b
Thanks man its working now!