From a88525feb0dcf7d46bebcb87be4125569bb5da3b Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Tue, 11 Nov 2025 19:10:13 +0000 Subject: fix: org switch issue on consumer when dev org exists (#577) --- packages/lib/auth-context.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/lib/auth-context.tsx b/packages/lib/auth-context.tsx index db24ec45..324b213e 100644 --- a/packages/lib/auth-context.tsx +++ b/packages/lib/auth-context.tsx @@ -41,15 +41,16 @@ export function AuthProvider({ children }: { children: ReactNode }) { authClient.organization .getFullOrganization() .then((org) => { - // TODO: Uncomment this when we have a way to handle consumer organizations better way - //if (org.metadata?.isConsumer === true) { - setOrg(org) - //} else { - // const consumerOrg = orgs?.find((o) => o.metadata?.isConsumer === true) - // if (consumerOrg) { - // setActiveOrg(consumerOrg.slug) - // } - //} + if (org.metadata?.isConsumer === true) { + console.log("Consumer organization:", org) + setOrg(org) + } else { + console.log("ALl orgs:", orgs) + const consumerOrg = orgs?.find((o) => o.metadata?.isConsumer === true) + if (consumerOrg) { + setActiveOrg(consumerOrg.slug) + } + } }) .catch((error) => { // Silently handle organization fetch failures to prevent unhandled rejections -- cgit v1.2.3