From 2ecbd5d2908ceb8d15e8cf62cc4ae13a3e555b48 Mon Sep 17 00:00:00 2001 From: Dimitris Klouvas Date: Wed, 8 Nov 2023 18:52:12 +0200 Subject: [PATCH] fix(remix): Avoid always showing `frontendApi` deprecation --- .changeset/plenty-bottles-grow.md | 5 +++++ packages/remix/src/ssr/utils.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/plenty-bottles-grow.md diff --git a/.changeset/plenty-bottles-grow.md b/.changeset/plenty-bottles-grow.md new file mode 100644 index 00000000000..5e58098a84b --- /dev/null +++ b/.changeset/plenty-bottles-grow.md @@ -0,0 +1,5 @@ +--- +'@clerk/remix': patch +--- + +Avoid always showing deprecation warnings for `frontendApi` in `@clerk/remix` diff --git a/packages/remix/src/ssr/utils.ts b/packages/remix/src/ssr/utils.ts index f6fd8aa99ed..e944548a505 100644 --- a/packages/remix/src/ssr/utils.ts +++ b/packages/remix/src/ssr/utils.ts @@ -86,7 +86,9 @@ export const interstitialJsonResponse = ( __loader: opts.loader, __clerk_ssr_interstitial_html: loadInterstitialFromLocal({ debugData: debugRequestState(requestState), - frontendApi: requestState.frontendApi, + // Use frontendApi only when legacy frontendApi is used to avoid showing deprecation warning + // since the requestState always contains the frontendApi constructed by publishableKey. + frontendApi: requestState.publishableKey ? '' : requestState.frontendApi, publishableKey: requestState.publishableKey, // TODO: This needs to be the version of clerk/remix not clerk/react // pkgVersion: LIB_VERSION, @@ -155,7 +157,9 @@ export function getResponseClerkState(requestState: RequestState, context: AppLo const { reason, message, isSignedIn, isInterstitial, ...rest } = requestState; const clerkState = wrapWithClerkState({ __clerk_ssr_state: rest.toAuth(), - __frontendApi: requestState.frontendApi, + // Use frontendApi only when legacy frontendApi is used to avoid showing deprecation warning + // since the requestState always contains the frontendApi constructed by publishableKey. + __frontendApi: requestState.publishableKey ? '' : requestState.frontendApi, __publishableKey: requestState.publishableKey, __proxyUrl: requestState.proxyUrl, __domain: requestState.domain,