Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/happy-drinks-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@clerk/clerk-js": patch
"@clerk/shared": patch
---

Added development runtime error when mounting `<OAuthconsent />` without active session.
9 changes: 9 additions & 0 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,15 @@ export class Clerk implements ClerkInterface {
};

public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
if (noUserExists(this)) {
if (this.#instanceType === 'development') {
throw new ClerkRuntimeError(warnings.cannotRenderOAuthConsentComponentWhenUserDoesNotExist, {
code: CANNOT_RENDER_USER_MISSING_ERROR_CODE,
});
}
return;
}

this.assertComponentsReady(this.#clerkUI);
const component = 'OAuthConsent';
void this.#clerkUI
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/internal/clerk-js/warnings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ const warnings = {
'The <APIKeys/> component cannot be rendered when user API keys are disabled. Since user API keys are disabled, this is no-op.',
cannotRenderAPIKeysComponentForOrgWhenDisabled:
'The <APIKeys/> component cannot be rendered when organization API keys are disabled. Since organization API keys are disabled, this is no-op.',
cannotRenderOAuthConsentComponentWhenUserDoesNotExist:
'<OAuthConsent/> cannot render unless a user is signed in. Since no user is signed in, this is no-op.',
};

type SerializableWarnings = Serializable<typeof warnings>;
Expand Down
Loading