Skip to content

Commit a9894b4

Browse files
chore(clerk-js,types,shared): Deprecate __unstable methods for organizations (#1879)
* chore(clerk-js,types,shared): Deprecate `__unstable` methods for organizations * Update light-coats-brush.md --------- Co-authored-by: Nikos Douvlis <nikosdouvlis@gmail.com>
1 parent cc9c483 commit a9894b4

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

.changeset/light-coats-brush.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/shared': patch
4+
'@clerk/types': patch
5+
---
6+
7+
Deprecate the `organization.__unstable__invitationUpdate` and `organization.__unstable__membershipUpdate` methods.

packages/clerk-js/src/core/clerk.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,14 @@ export default class Clerk implements ClerkInterface {
170170
#fapiClient: FapiClient;
171171
#instanceType: InstanceType;
172172
#isReady = false;
173+
174+
/**
175+
* @deprecated Although this being a private field, this is a reminder to drop it with the next major release
176+
*/
173177
#lastOrganizationInvitation: OrganizationInvitationResource | null = null;
178+
/**
179+
* @deprecated Although this being a private field, this is a reminder to drop it with the next major release
180+
*/
174181
#lastOrganizationMember: OrganizationMembershipResource | null = null;
175182
#listeners: Array<(emission: Resources) => void> = [];
176183
#options: ClerkOptions = {};
@@ -1185,12 +1192,28 @@ export default class Clerk implements ClerkInterface {
11851192
this.#emit();
11861193
};
11871194

1195+
/**
1196+
* @deprecated This method will be dropped in the next major release.
1197+
* This method is only used in another deprecated part: `invitationList` from useOrganization
1198+
*/
11881199
__unstable__invitationUpdate(invitation: OrganizationInvitationResource) {
1200+
deprecated(
1201+
'__unstable__invitationUpdate',
1202+
'We are completely dropping this method as it was introduced for internal use only',
1203+
);
11891204
this.#lastOrganizationInvitation = invitation;
11901205
this.#emit();
11911206
}
11921207

1208+
/**
1209+
* @deprecated This method will be dropped in the next major release.
1210+
* This method is only used in another deprecated part: `membershipList` from useOrganization
1211+
*/
11931212
__unstable__membershipUpdate(membership: OrganizationMembershipResource) {
1213+
deprecated(
1214+
'__unstable__invitationUpdate',
1215+
'We are completely dropping this method as it was introduced for internal use only',
1216+
);
11941217
this.#lastOrganizationMember = membership;
11951218
this.#emit();
11961219
}

packages/shared/src/hooks/contexts.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,16 @@ const [SessionContext, useSessionContext] = createContextAndHook<ActiveSessionRe
2525

2626
type OrganizationContextProps = {
2727
organization: OrganizationResource | null | undefined;
28+
29+
/**
30+
* @deprecated This property will be dropped in the next major release.
31+
* This property is only used in another deprecated part: `invitationList` from useOrganization
32+
*/
2833
lastOrganizationInvitation: OrganizationInvitationResource | null | undefined;
34+
/**
35+
* @deprecated This property will be dropped in the next major release.
36+
* This property is only used in another deprecated part: `membershipList` from useOrganization
37+
*/
2938
lastOrganizationMember: OrganizationMembershipResource | null | undefined;
3039
};
3140
const [OrganizationContextInternal, useOrganizationContext] = createContextAndHook<{

packages/types/src/clerk.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,15 @@ export interface Resources {
554554
session?: ActiveSessionResource | null;
555555
user?: UserResource | null;
556556
organization?: OrganizationResource | null;
557+
/**
558+
* @deprecated This property will be dropped in the next major release.
559+
* This property is only used in another deprecated part: `invitationList` from useOrganization
560+
*/
557561
lastOrganizationInvitation?: OrganizationInvitationResource | null;
562+
/**
563+
* @deprecated This property will be dropped in the next major release.
564+
* This property is only used in another deprecated part: `membershipList` from useOrganization
565+
*/
558566
lastOrganizationMember?: OrganizationMembershipResource | null;
559567
}
560568

0 commit comments

Comments
 (0)