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
5 changes: 5 additions & 0 deletions .changeset/modern-badgers-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/clerk-js": patch
---

Add development mode warning in the browser console when `load()` happens. Companion PR for [Add dev mode warning to components](https://github.com/clerk/javascript/pull/3870).
8 changes: 8 additions & 0 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
proxyUrlToAbsoluteURL,
stripScheme,
} from '@clerk/shared';
import { logger } from '@clerk/shared/logger';
import { eventPrebuiltComponentMounted, TelemetryCollector } from '@clerk/shared/telemetry';
import type {
ActiveSessionResource,
Expand Down Expand Up @@ -271,6 +272,13 @@ export class Clerk implements ClerkInterface {
return;
}

// Log a development mode warning once
if (this.#instanceType === 'development') {
logger.warnOnce(
'Clerk: Clerk has been loaded with development keys. Development instances have strict usage limits and should not be used when deploying your application to production. Learn more: https://clerk.com/docs/deployments/overview',
);
}

this.#options = {
...defaultOptions,
...options,
Expand Down
6 changes: 2 additions & 4 deletions packages/clerk-js/src/utils/assertNoLegacyProp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ export function assertNoLegacyProp(props: Record<string, any>) {
const legacyProp = Object.keys(props).find(key => legacyProps.includes(key));

if (legacyProp && props[legacyProp]) {
// TODO: @nikos update with the docs link
logger.warnOnce(
`Clerk: The prop "${legacyProp}" is deprecated and should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead.`,
`Clerk: The prop "${legacyProp}" is deprecated and should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead. Learn more: https://clerk.com/docs/guides/custom-redirects#redirect-url-props`,
);
}
}
Expand All @@ -19,9 +18,8 @@ export function warnForNewPropShadowingLegacyProp(
legacyValue: string | undefined | null,
) {
if (newValue && legacyValue) {
// TODO: @nikos update with the docs link
logger.warnOnce(
`Clerk: The "${newKey}" prop ("${newValue}") has priority over the legacy "${legacyKey}" (or "redirectUrl") ("${legacyValue}"), which will be completely ignored in this case. "${legacyKey}" (or "redirectUrl" prop) should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead.`,
`Clerk: The "${newKey}" prop ("${newValue}") has priority over the legacy "${legacyKey}" (or "redirectUrl") ("${legacyValue}"), which will be completely ignored in this case. "${legacyKey}" (or "redirectUrl" prop) should be replaced with the new "fallbackRedirectUrl" or "forceRedirectUrl" props instead. Learn more: https://clerk.com/docs/guides/custom-redirects#redirect-url-props`,
);
}
}