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
9 changes: 9 additions & 0 deletions .changeset/shiny-pants-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@clerk/clerk-js': minor
'@clerk/astro': minor
'@clerk/clerk-react': minor
'@clerk/types': minor
'@clerk/vue': minor
---

Remove `treatPendingAsSignedOut` from Clerk options
1 change: 0 additions & 1 deletion packages/astro/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ interface InternalEnv {
readonly PUBLIC_CLERK_SIGN_UP_URL?: string;
readonly PUBLIC_CLERK_TELEMETRY_DISABLED?: string;
readonly PUBLIC_CLERK_TELEMETRY_DEBUG?: string;
readonly PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT?: string;
}

interface ImportMeta {
Expand Down
11 changes: 1 addition & 10 deletions packages/astro/src/integration/create-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ type HotloadAstroClerkIntegrationParams = AstroClerkIntegrationParams & {

function createIntegration<Params extends HotloadAstroClerkIntegrationParams>() {
return (params?: Params): AstroIntegration => {
const {
proxyUrl,
isSatellite,
domain,
signInUrl,
signUpUrl,
enableEnvSchema = true,
treatPendingAsSignedOut,
} = params || {};
const { proxyUrl, isSatellite, domain, signInUrl, signUpUrl, enableEnvSchema = true } = params || {};

// These are not provided when the "bundled" integration is used
const clerkJSUrl = (params as any)?.clerkJSUrl as string | undefined;
Expand Down Expand Up @@ -65,7 +57,6 @@ function createIntegration<Params extends HotloadAstroClerkIntegrationParams>()
/**
* Convert the integration params to environment variable in order for it to be readable from the server
*/
...buildEnvVarFromOption(treatPendingAsSignedOut, 'PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT'),
...buildEnvVarFromOption(signInUrl, 'PUBLIC_CLERK_SIGN_IN_URL'),
...buildEnvVarFromOption(signUpUrl, 'PUBLIC_CLERK_SIGN_UP_URL'),
...buildEnvVarFromOption(isSatellite, 'PUBLIC_CLERK_IS_SATELLITE'),
Expand Down
9 changes: 2 additions & 7 deletions packages/astro/src/react/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useCallback, useSyncExternalStore } from 'react';

import { authAsyncStorage } from '#async-local-storage';

import { $authStore, $clerkStore } from '../stores/external';
import { $authStore } from '../stores/external';
import { $clerk, $csrState } from '../stores/internal';

/**
Expand Down Expand Up @@ -87,7 +87,6 @@ type UseAuth = (options?: PendingSessionOptions) => UseAuthReturn;
*/
export const useAuth: UseAuth = ({ treatPendingAsSignedOut } = {}) => {
const authContext = useAuthStore();
const clerkContext = useStore($clerkStore);

const getToken: GetToken = useCallback(createGetToken(), []);
const signOut: SignOut = useCallback(createSignOut(), []);
Expand Down Expand Up @@ -117,11 +116,7 @@ export const useAuth: UseAuth = ({ treatPendingAsSignedOut } = {}) => {
has,
},
options: {
treatPendingAsSignedOut:
// Fallback from option provided via SSR / CSR contexts
treatPendingAsSignedOut ??
clerkContext?.__internal_getOption?.('treatPendingAsSignedOut') ??
import.meta.env.PUBLIC_CLERK_TREAT_PENDING_AS_SIGNED_OUT,
treatPendingAsSignedOut,
},
});

Expand Down
5 changes: 1 addition & 4 deletions packages/clerk-js/src/core/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ const defaultOptions: ClerkOptions = {
signUpFallbackRedirectUrl: undefined,
signInForceRedirectUrl: undefined,
signUpForceRedirectUrl: undefined,
treatPendingAsSignedOut: true,
newSubscriptionRedirectUrl: undefined,
};

Expand Down Expand Up @@ -360,10 +359,8 @@ export class Clerk implements ClerkInterface {
}

get isSignedIn(): boolean {
const { treatPendingAsSignedOut } = this.#options;

const hasPendingSession = this?.session?.status === 'pending';
if (treatPendingAsSignedOut && hasPendingSession) {
if (hasPendingSession) {
return false;
}

Expand Down
3 changes: 1 addition & 2 deletions packages/react/src/hooks/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ export const useAuth = (initialAuthStateOrOptions: UseAuthOptions = {}): UseAuth
signOut,
},
{
treatPendingAsSignedOut:
treatPendingAsSignedOut ?? isomorphicClerk.__internal_getOption?.('treatPendingAsSignedOut'),
treatPendingAsSignedOut,
},
);
};
Expand Down
5 changes: 2 additions & 3 deletions packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import type {
SignUpFallbackRedirectUrl,
SignUpForceRedirectUrl,
} from './redirects';
import type { PendingSessionOptions, SessionTask, SignedInSessionResource } from './session';
import type { SessionTask, SignedInSessionResource } from './session';
import type { SessionVerificationLevel } from './sessionVerification';
import type { SignInResource } from './signIn';
import type { SignUpResource } from './signUp';
Expand Down Expand Up @@ -962,8 +962,7 @@ type ClerkOptionsNavigation =
routerDebug?: boolean;
};

export type ClerkOptions = PendingSessionOptions &
ClerkOptionsNavigation &
export type ClerkOptions = ClerkOptionsNavigation &
SignInForceRedirectUrl &
SignInFallbackRedirectUrl &
SignUpForceRedirectUrl &
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/src/composables/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type UseAuth = (options?: PendingSessionOptions) => ToComputedRefs<UseAuthReturn
* </template>
*/
export const useAuth: UseAuth = (options = {}) => {
const { clerk, authCtx, ...contextOptions } = useClerkContext();
const { clerk, authCtx } = useClerkContext();

const getToken: GetToken = createGetToken(clerk);
const signOut: SignOut = createSignOut(clerk);
Expand All @@ -100,7 +100,7 @@ export const useAuth: UseAuth = (options = {}) => {
has,
},
options: {
treatPendingAsSignedOut: options.treatPendingAsSignedOut ?? contextOptions.treatPendingAsSignedOut,
treatPendingAsSignedOut: options.treatPendingAsSignedOut,
},
});

Expand Down
2 changes: 0 additions & 2 deletions packages/vue/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ export const clerkPlugin: Plugin<[PluginOptions]> = {
sessionCtx,
userCtx,
organizationCtx,
treatPendingAsSignedOut:
options.treatPendingAsSignedOut ?? clerk.value?.__internal_getOption?.('treatPendingAsSignedOut'),
});
},
};