kinde-oss / kinde-auth-nextjs

Kinde NextJS SDK - authentication for server rendered apps
https://kinde.com/docs/developer-tools/nextjs-sdk/
MIT License
149 stars 20 forks source link

Bug: Wrong return type on `getUserOrganizations()` #211

Open drochag opened 4 days ago

drochag commented 4 days ago

Prerequisites

Describe the issue

When using useKindeBrowserClient, getUserOrganizations() and userOrganizations are arays on page load as opposed to KindeOrganiztions or KindeOrganizations | null as mentioned, breaking the typings

const { userOrganizations, getUserOrganizations } = useKindeBrowserClient();
const userOrgs = getUserOrganizations();

console.log('userOrganizations', userOrganizations, `isArray: ${Array.isArray(userOrganizations)}`);
console.log('userOrgs', userOrgs, `isArray: ${Array.isArray(userOrgs)}`);

Screenshot 2024-09-20 at 3 32 33 a m

Library URL

https://github.com/kinde-oss/kinde-auth-nextjs

Library version

2.3.8

Operating system(s)

macOS

Operating system version(s)

Sonoma 14.6

Further environment details

No response

Reproducible test case URL

https://github.com/drochag/kinde-nextjs-app-router-starter-kit/pull/1

Additional information

No response

peterphanouvong commented 4 days ago

Thanks @drochag, I'll push a fix for this