Skip to content

Commit 672e8d1

Browse files
committed
Remove treatPendingAsSignedOut as Clerk option
1 parent cf284ee commit 672e8d1

File tree

9 files changed

+17
-29
lines changed

9 files changed

+17
-29
lines changed

.changeset/shiny-pants-jump.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@clerk/clerk-js': minor
3+
'@clerk/astro': minor
4+
'@clerk/clerk-react': minor
5+
'@clerk/types': minor
6+
'@clerk/vue': minor
7+
---
8+
9+
Remove `treatPendingAsSignedOut` from Clerk options

packages/astro/src/env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ interface InternalEnv {
1919
readonly PUBLIC_CLERK_SIGN_UP_URL?: string;
2020
readonly PUBLIC_CLERK_TELEMETRY_DISABLED?: string;
2121
readonly PUBLIC_CLERK_TELEMETRY_DEBUG?: string;
22-
readonly PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT?: string;
2322
}
2423

2524
interface ImportMeta {

packages/astro/src/integration/create-integration.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@ type HotloadAstroClerkIntegrationParams = AstroClerkIntegrationParams & {
1919

2020
function createIntegration<Params extends HotloadAstroClerkIntegrationParams>() {
2121
return (params?: Params): AstroIntegration => {
22-
const {
23-
proxyUrl,
24-
isSatellite,
25-
domain,
26-
signInUrl,
27-
signUpUrl,
28-
enableEnvSchema = true,
29-
treatPendingAsSignedOut,
30-
} = params || {};
22+
const { proxyUrl, isSatellite, domain, signInUrl, signUpUrl, enableEnvSchema = true } = params || {};
3123

3224
// These are not provided when the "bundled" integration is used
3325
const clerkJSUrl = (params as any)?.clerkJSUrl as string | undefined;
@@ -65,7 +57,6 @@ function createIntegration<Params extends HotloadAstroClerkIntegrationParams>()
6557
/**
6658
* Convert the integration params to environment variable in order for it to be readable from the server
6759
*/
68-
...buildEnvVarFromOption(treatPendingAsSignedOut, 'PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT'),
6960
...buildEnvVarFromOption(signInUrl, 'PUBLIC_CLERK_SIGN_IN_URL'),
7061
...buildEnvVarFromOption(signUpUrl, 'PUBLIC_CLERK_SIGN_UP_URL'),
7162
...buildEnvVarFromOption(isSatellite, 'PUBLIC_CLERK_IS_SATELLITE'),

packages/astro/src/react/hooks.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,7 @@ export const useAuth: UseAuth = ({ treatPendingAsSignedOut } = {}) => {
117117
has,
118118
},
119119
options: {
120-
treatPendingAsSignedOut:
121-
// Fallback from option provided via SSR / CSR contexts
122-
treatPendingAsSignedOut ??
123-
clerkContext?.__internal_getOption?.('treatPendingAsSignedOut') ??
124-
import.meta.env.PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT,
120+
treatPendingAsSignedOut,
125121
},
126122
});
127123

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ const defaultOptions: ClerkOptions = {
189189
signUpFallbackRedirectUrl: undefined,
190190
signInForceRedirectUrl: undefined,
191191
signUpForceRedirectUrl: undefined,
192-
treatPendingAsSignedOut: true,
193192
newSubscriptionRedirectUrl: undefined,
194193
};
195194

@@ -360,10 +359,8 @@ export class Clerk implements ClerkInterface {
360359
}
361360

362361
get isSignedIn(): boolean {
363-
const { treatPendingAsSignedOut } = this.#options;
364-
365362
const hasPendingSession = this?.session?.status === 'pending';
366-
if (treatPendingAsSignedOut && hasPendingSession) {
363+
if (hasPendingSession) {
367364
return false;
368365
}
369366

packages/react/src/hooks/useAuth.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ export const useAuth = (initialAuthStateOrOptions: UseAuthOptions = {}): UseAuth
118118
signOut,
119119
},
120120
{
121-
treatPendingAsSignedOut:
122-
treatPendingAsSignedOut ?? isomorphicClerk.__internal_getOption?.('treatPendingAsSignedOut'),
121+
treatPendingAsSignedOut,
123122
},
124123
);
125124
};

packages/types/src/clerk.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import type {
4949
SignUpFallbackRedirectUrl,
5050
SignUpForceRedirectUrl,
5151
} from './redirects';
52-
import type { PendingSessionOptions, SessionTask, SignedInSessionResource } from './session';
52+
import type { SessionTask, SignedInSessionResource } from './session';
5353
import type { SessionVerificationLevel } from './sessionVerification';
5454
import type { SignInResource } from './signIn';
5555
import type { SignUpResource } from './signUp';
@@ -962,8 +962,7 @@ type ClerkOptionsNavigation =
962962
routerDebug?: boolean;
963963
};
964964

965-
export type ClerkOptions = PendingSessionOptions &
966-
ClerkOptionsNavigation &
965+
export type ClerkOptions = ClerkOptionsNavigation &
967966
SignInForceRedirectUrl &
968967
SignInFallbackRedirectUrl &
969968
SignUpForceRedirectUrl &

packages/vue/src/composables/useAuth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type UseAuth = (options?: PendingSessionOptions) => ToComputedRefs<UseAuthReturn
7474
* </template>
7575
*/
7676
export const useAuth: UseAuth = (options = {}) => {
77-
const { clerk, authCtx, ...contextOptions } = useClerkContext();
77+
const { clerk, authCtx } = useClerkContext();
7878

7979
const getToken: GetToken = createGetToken(clerk);
8080
const signOut: SignOut = createSignOut(clerk);
@@ -100,7 +100,7 @@ export const useAuth: UseAuth = (options = {}) => {
100100
has,
101101
},
102102
options: {
103-
treatPendingAsSignedOut: options.treatPendingAsSignedOut ?? contextOptions.treatPendingAsSignedOut,
103+
treatPendingAsSignedOut: options.treatPendingAsSignedOut,
104104
},
105105
});
106106

packages/vue/src/plugin.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ export const clerkPlugin: Plugin<[PluginOptions]> = {
118118
sessionCtx,
119119
userCtx,
120120
organizationCtx,
121-
treatPendingAsSignedOut:
122-
options.treatPendingAsSignedOut ?? clerk.value?.__internal_getOption?.('treatPendingAsSignedOut'),
123121
});
124122
},
125123
};

0 commit comments

Comments
 (0)