@clerk/clerk-react
Advanced tools
Comparing version 3.4.5 to 3.5.0
@@ -76,4 +76,3 @@ "use strict"; | ||
const session = initialState.session; | ||
// TODO: Fix post-SSR decision | ||
const organization = undefined; | ||
const organization = initialState.organization; | ||
return { | ||
@@ -80,0 +79,0 @@ sessionId, |
@@ -13,7 +13,13 @@ import { GetMembershipsParams, GetPendingInvitationsParams, OrganizationInvitationResource, OrganizationMembershipResource, OrganizationResource } from '@clerk/types'; | ||
} | { | ||
isLoaded: true; | ||
organization: OrganizationResource; | ||
invitationList: undefined; | ||
membershipList: undefined; | ||
membership: undefined; | ||
} | { | ||
isLoaded: boolean; | ||
organization: OrganizationResource | null | undefined; | ||
organization: OrganizationResource | null; | ||
invitationList: OrganizationInvitationResource[] | null | undefined; | ||
membershipList: OrganizationMembershipResource[] | null | undefined; | ||
membership: OrganizationMembershipResource | undefined; | ||
membership: OrganizationMembershipResource | null | undefined; | ||
}; | ||
@@ -20,0 +26,0 @@ declare type UseOrganization = (params?: UseOrganizationParams) => UseOrganizationReturn; |
@@ -29,4 +29,3 @@ "use strict"; | ||
: null, currentOrganizationMemberships); | ||
// TODO re-iterate on SSR based on value of `organization` | ||
if (!isomorphicClerk.loaded || !session || !organization) { | ||
if (organization === undefined) { | ||
return { | ||
@@ -40,2 +39,21 @@ isLoaded: false, | ||
} | ||
if (organization === null) { | ||
return { | ||
isLoaded: true, | ||
organization: null, | ||
invitationList: null, | ||
membershipList: null, | ||
membership: null, | ||
}; | ||
} | ||
/** In SSR context we include only the organization object when loadOrg is set to true. */ | ||
if (!isomorphicClerk.loaded && organization) { | ||
return { | ||
isLoaded: true, | ||
organization, | ||
invitationList: undefined, | ||
membershipList: undefined, | ||
membership: undefined, | ||
}; | ||
} | ||
return { | ||
@@ -42,0 +60,0 @@ isLoaded: !isMembershipsLoading && !isInvitationsLoading, |
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */ | ||
export declare const LIB_VERSION = "3.4.5"; | ||
export declare const LIB_VERSION = "3.5.0"; | ||
export declare const LIB_NAME = "@clerk/clerk-react"; | ||
//# sourceMappingURL=info.d.ts.map |
@@ -5,4 +5,4 @@ "use strict"; | ||
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */ | ||
exports.LIB_VERSION = '3.4.5'; | ||
exports.LIB_VERSION = '3.5.0'; | ||
exports.LIB_NAME = '@clerk/clerk-react'; | ||
//# sourceMappingURL=info.js.map |
{ | ||
"name": "@clerk/clerk-react", | ||
"version": "3.4.5", | ||
"version": "3.5.0", | ||
"license": "MIT", | ||
@@ -31,3 +31,3 @@ "description": "Clerk.dev React library", | ||
"dependencies": { | ||
"@clerk/types": "^2.19.1", | ||
"@clerk/types": "^2.20.0", | ||
"swr": "^1.3.0", | ||
@@ -72,3 +72,3 @@ "tslib": "^2.3.1" | ||
"homepage": "https://clerk.dev/", | ||
"gitHead": "87f283047898f84b0b13f55952e356e6a10736ac" | ||
"gitHead": "92bc6888721d7bbbcf227469a30e64a306ff49f6" | ||
} |
@@ -29,7 +29,14 @@ import { | ||
| { | ||
isLoaded: true; | ||
organization: OrganizationResource; | ||
invitationList: undefined; | ||
membershipList: undefined; | ||
membership: undefined; | ||
} | ||
| { | ||
isLoaded: boolean; | ||
organization: OrganizationResource | null | undefined; | ||
organization: OrganizationResource | null; | ||
invitationList: OrganizationInvitationResource[] | null | undefined; | ||
membershipList: OrganizationMembershipResource[] | null | undefined; | ||
membership: OrganizationMembershipResource | undefined; | ||
membership: OrganizationMembershipResource | null | undefined; | ||
}; | ||
@@ -47,2 +54,3 @@ | ||
const isomorphicClerk = useIsomorphicClerkContext(); | ||
const clerk = isomorphicClerk as unknown as LoadedClerk; | ||
@@ -75,4 +83,3 @@ const shouldFetch = isomorphicClerk.loaded && session && organization; | ||
// TODO re-iterate on SSR based on value of `organization` | ||
if (!isomorphicClerk.loaded || !session || !organization) { | ||
if (organization === undefined) { | ||
return { | ||
@@ -87,2 +94,23 @@ isLoaded: false, | ||
if (organization === null) { | ||
return { | ||
isLoaded: true, | ||
organization: null, | ||
invitationList: null, | ||
membershipList: null, | ||
membership: null, | ||
}; | ||
} | ||
/** In SSR context we include only the organization object when loadOrg is set to true. */ | ||
if (!isomorphicClerk.loaded && organization) { | ||
return { | ||
isLoaded: true, | ||
organization, | ||
invitationList: undefined, | ||
membershipList: undefined, | ||
membership: undefined, | ||
}; | ||
} | ||
return { | ||
@@ -92,3 +120,3 @@ isLoaded: !isMembershipsLoading && !isInvitationsLoading, | ||
membershipList, | ||
membership: getCurrentOrganizationMembership(session.user.organizationMemberships, organization.id), // your membership in the current org | ||
membership: getCurrentOrganizationMembership(session!.user.organizationMemberships, organization.id), // your membership in the current org | ||
invitationList, | ||
@@ -95,0 +123,0 @@ }; |
/** DO NOT EDIT: This file is automatically generated by ../scripts/info.js */ | ||
export const LIB_VERSION = '3.4.5'; | ||
export const LIB_VERSION = '3.5.0'; | ||
export const LIB_NAME = '@clerk/clerk-react'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
268551
4680
Updated@clerk/types@^2.20.0