How to get client to immediately update activeOrganizationId after creating an organization?
Hello!
I have some code that redirects users to setup an organization after they first sign up
When they submit the organization form I call
I expected this to automatically update the session cookie w/ the 
activeOrganizationId although I found that not to be the case. However, even when I try to explicitly refresh the session before redirecting to the dashboard page it doesn't work
Only refreshing the page entirely gets activeOrganizationId in the session.
Is there any easy way to achieve what I want? What am I missing?
Thanks!3 Replies
So really there are 3 things I’m confused about
1. Why doesn’t createOrganization update the session cookie?
2. It seems like isPending starts off as false and then the queries for things like useSession and useActiveOrganization are kicked off synchronously. If that’s the case then I’m not sure how you’re supposed to use isPending for rendering components.
3. Why doesn’t explicitly calling get session with the cache disabled work?
this works for me, not sure if helpful...
I solved by calling 
refetch, I think it is related to https://github.com/better-auth/better-auth/issues/1006GitHub
useSession() not always triggering a state change · Issue #1006 ...Is this suited for github? Yes, this is suited for github To Reproduce Sign in with email and password Use useSession() in the following component: export function AuthLayout({ children }: AppLayou...