Skip to content

Commit f976349

Browse files
alexcarpenterbrkalow
andauthoredJan 31, 2025··
Revert "refactor(clerk-js,types): Remove virtual routing option from component types" (#5057)
Co-authored-by: Bryce Kalow <bryce@clerk.dev>
1 parent 7233825 commit f976349

File tree

8 files changed

+29
-40
lines changed

8 files changed

+29
-40
lines changed
 

‎.changeset/smart-worms-collect.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Reverts [#4977](https://github.com/clerk/javascript/pull/4977)
7+
8+
Marks virtual routing as deprecated.

‎packages/clerk-js/src/ui/components/OrganizationProfile/OrganizationProfile.tsx

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { useOrganization } from '@clerk/shared/react';
2-
import type { OrganizationProfileModalProps, OrganizationProfileProps, WithInternalRouting } from '@clerk/types';
2+
import type { OrganizationProfileModalProps, OrganizationProfileProps } from '@clerk/types';
33
import React from 'react';
4-
import type { OrganizationProfileCtx } from 'ui/types';
54

65
import { OrganizationProfileContext, withCoreUserGuard } from '../../contexts';
76
import { Flow, localizationKeys } from '../../customizables';
87
import { NavbarMenuButtonRow, ProfileCard, withCardStateProvider } from '../../elements';
98
import { Route, Switch } from '../../router';
9+
import type { OrganizationProfileCtx } from '../../types';
1010
import { OrganizationProfileNavbar } from './OrganizationProfileNavbar';
1111
import { OrganizationProfileRoutes } from './OrganizationProfileRoutes';
1212

13-
const _OrganizationProfile = () => {
13+
const _OrganizationProfile = (_: OrganizationProfileProps) => {
1414
const { organization } = useOrganization();
1515

1616
if (!organization) {
@@ -48,9 +48,6 @@ const AuthenticatedRoutes = withCoreUserGuard(() => {
4848

4949
export const OrganizationProfile = withCardStateProvider(_OrganizationProfile);
5050

51-
const InternalOrganizationProfile: React.ComponentType<WithInternalRouting<OrganizationProfileProps>> =
52-
withCardStateProvider(_OrganizationProfile);
53-
5451
export const OrganizationProfileModal = (props: OrganizationProfileModalProps): JSX.Element => {
5552
const organizationProfileProps: OrganizationProfileCtx = {
5653
...props,
@@ -64,7 +61,7 @@ export const OrganizationProfileModal = (props: OrganizationProfileModalProps):
6461
<OrganizationProfileContext.Provider value={organizationProfileProps}>
6562
{/*TODO: Used by InvisibleRootBox, can we simplify? */}
6663
<div>
67-
<InternalOrganizationProfile {...organizationProfileProps} />
64+
<OrganizationProfile {...organizationProfileProps} />
6865
</div>
6966
</OrganizationProfileContext.Provider>
7067
</Route>

‎packages/clerk-js/src/ui/components/SignIn/SignIn.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useClerk } from '@clerk/shared/react';
2-
import type { SignInModalProps, SignInProps, WithInternalRouting } from '@clerk/types';
2+
import type { SignInModalProps, SignInProps } from '@clerk/types';
33
import React from 'react';
44

55
import { normalizeRoutingOptions } from '../../../utils/normalizeRoutingOptions';
@@ -166,8 +166,6 @@ SignInRoutes.displayName = 'SignIn';
166166

167167
export const SignIn: React.ComponentType<SignInProps> = withCoreSessionSwitchGuard(SignInRoot);
168168

169-
const InternalSignIn: React.ComponentType<WithInternalRouting<SignInProps>> = withCoreSessionSwitchGuard(SignInRoot);
170-
171169
export const SignInModal = (props: SignInModalProps): JSX.Element => {
172170
const signInProps = {
173171
signUpUrl: `/${VIRTUAL_ROUTER_BASE_PATH}/sign-up`,
@@ -187,7 +185,7 @@ export const SignInModal = (props: SignInModalProps): JSX.Element => {
187185
>
188186
{/*TODO: Used by InvisibleRootBox, can we simplify? */}
189187
<div>
190-
<InternalSignIn
188+
<SignIn
191189
{...signInProps}
192190
routing='virtual'
193191
/>

‎packages/clerk-js/src/ui/components/SignUp/SignUp.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useClerk } from '@clerk/shared/react';
2-
import type { SignUpModalProps, SignUpProps, WithInternalRouting } from '@clerk/types';
2+
import type { SignUpModalProps, SignUpProps } from '@clerk/types';
33
import React from 'react';
44

55
import { SignUpEmailLinkFlowComplete } from '../../common/EmailLinkCompleteFlowCard';
@@ -89,8 +89,6 @@ SignUpRoutes.displayName = 'SignUp';
8989

9090
export const SignUp: React.ComponentType<SignUpProps> = withCoreSessionSwitchGuard(SignUpRoutes);
9191

92-
const InternalSignUp: React.ComponentType<WithInternalRouting<SignUpProps>> = withCoreSessionSwitchGuard(SignUpRoutes);
93-
9492
export const SignUpModal = (props: SignUpModalProps): JSX.Element => {
9593
const signUpProps = {
9694
signInUrl: `/${VIRTUAL_ROUTER_BASE_PATH}/sign-in`,
@@ -110,7 +108,7 @@ export const SignUpModal = (props: SignUpModalProps): JSX.Element => {
110108
>
111109
{/*TODO: Used by InvisibleRootBox, can we simplify? */}
112110
<div>
113-
<InternalSignUp
111+
<SignUp
114112
{...signUpProps}
115113
routing='virtual'
116114
/>

‎packages/clerk-js/src/ui/components/UserProfile/UserProfile.tsx

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { UserProfileModalProps, UserProfileProps, WithInternalRouting } from '@clerk/types';
1+
import type { UserProfileModalProps, UserProfileProps } from '@clerk/types';
22
import React from 'react';
33

44
import { UserProfileContext, withCoreUserGuard } from '../../contexts';
@@ -10,7 +10,7 @@ import { UserProfileNavbar } from './UserProfileNavbar';
1010
import { UserProfileRoutes } from './UserProfileRoutes';
1111
import { VerificationSuccessPage } from './VerifyWithLink';
1212

13-
const _UserProfile = () => {
13+
const _UserProfile = (_: UserProfileProps) => {
1414
return (
1515
<Flow.Root flow='userProfile'>
1616
<Flow.Part>
@@ -42,10 +42,7 @@ const AuthenticatedRoutes = withCoreUserGuard(() => {
4242
);
4343
});
4444

45-
export const UserProfile: React.ComponentType<UserProfileProps> = withCardStateProvider(_UserProfile);
46-
47-
const InternalUserProfile: React.ComponentType<WithInternalRouting<UserProfileProps>> =
48-
withCardStateProvider(_UserProfile);
45+
export const UserProfile = withCardStateProvider(_UserProfile);
4946

5047
export const UserProfileModal = (props: UserProfileModalProps): JSX.Element => {
5148
const userProfileProps: UserProfileCtx = {
@@ -60,7 +57,7 @@ export const UserProfileModal = (props: UserProfileModalProps): JSX.Element => {
6057
<UserProfileContext.Provider value={userProfileProps}>
6158
{/*TODO: Used by InvisibleRootBox, can we simplify? */}
6259
<div>
63-
<InternalUserProfile {...userProfileProps} />
60+
<UserProfile {...userProfileProps} />
6461
</div>
6562
</UserProfileContext.Provider>
6663
</Route>

‎packages/clerk-js/src/ui/components/UserVerification/index.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import type {
2-
__internal_UserVerificationModalProps,
3-
__internal_UserVerificationProps,
4-
WithInternalRouting,
5-
} from '@clerk/types';
1+
import type { __internal_UserVerificationModalProps, __internal_UserVerificationProps } from '@clerk/types';
62
import React, { useEffect } from 'react';
73

84
import { UserVerificationContext, withCoreSessionSwitchGuard } from '../../contexts';
@@ -35,7 +31,7 @@ function UserVerificationRoutes(): JSX.Element {
3531

3632
UserVerificationRoutes.displayName = 'UserVerification';
3733

38-
const UserVerification: React.ComponentType<WithInternalRouting<__internal_UserVerificationProps>> =
34+
const UserVerification: React.ComponentType<__internal_UserVerificationProps> =
3935
withCoreSessionSwitchGuard(UserVerificationRoutes);
4036

4137
const UserVerificationModal = (props: __internal_UserVerificationModalProps): JSX.Element => {

‎packages/clerk-js/src/ui/types.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import type {
1010
UserButtonProps,
1111
UserProfileProps,
1212
WaitlistProps,
13-
WithInternalRouting,
1413
} from '@clerk/types';
1514

1615
export type {
@@ -41,22 +40,22 @@ export type AvailableComponentProps =
4140

4241
type ComponentMode = 'modal' | 'mounted';
4342

44-
export type SignInCtx = WithInternalRouting<SignInProps> & {
43+
export type SignInCtx = SignInProps & {
4544
componentName: 'SignIn';
4645
mode?: ComponentMode;
4746
};
4847

49-
export type UserVerificationCtx = WithInternalRouting<__internal_UserVerificationProps> & {
48+
export type UserVerificationCtx = __internal_UserVerificationProps & {
5049
componentName: 'UserVerification';
5150
mode?: ComponentMode;
5251
};
5352

54-
export type UserProfileCtx = WithInternalRouting<UserProfileProps> & {
53+
export type UserProfileCtx = UserProfileProps & {
5554
componentName: 'UserProfile';
5655
mode?: ComponentMode;
5756
};
5857

59-
export type SignUpCtx = WithInternalRouting<SignUpProps> & {
58+
export type SignUpCtx = SignUpProps & {
6059
componentName: 'SignUp';
6160
mode?: ComponentMode;
6261
emailLinkRedirectUrl?: string;
@@ -68,12 +67,12 @@ export type UserButtonCtx = UserButtonProps & {
6867
mode?: ComponentMode;
6968
};
7069

71-
export type OrganizationProfileCtx = WithInternalRouting<OrganizationProfileProps> & {
70+
export type OrganizationProfileCtx = OrganizationProfileProps & {
7271
componentName: 'OrganizationProfile';
7372
mode?: ComponentMode;
7473
};
7574

76-
export type CreateOrganizationCtx = WithInternalRouting<CreateOrganizationProps> & {
75+
export type CreateOrganizationCtx = CreateOrganizationProps & {
7776
componentName: 'CreateOrganization';
7877
mode?: ComponentMode;
7978
};

‎packages/types/src/clerk.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -831,10 +831,6 @@ type RouterFn = (
831831

832832
export type WithoutRouting<T> = Omit<T, 'path' | 'routing'>;
833833

834-
export type WithInternalRouting<T> =
835-
| (Omit<T, 'routing' | 'path'> & { path: string | undefined; routing?: Extract<RoutingStrategy, 'path'> })
836-
| (Omit<T, 'routing' | 'path'> & { path?: never; routing?: Extract<RoutingStrategy, 'hash' | 'virtual'> });
837-
838834
export type SignInInitialValues = {
839835
emailAddress?: string;
840836
phoneNumber?: string;
@@ -896,7 +892,7 @@ export type SetActive = (params: SetActiveParams) => Promise<void>;
896892

897893
export type RoutingOptions =
898894
| { path: string | undefined; routing?: Extract<RoutingStrategy, 'path'> }
899-
| { path?: never; routing?: Extract<RoutingStrategy, 'hash'> };
895+
| { path?: never; routing?: Extract<RoutingStrategy, 'hash' | 'virtual'> };
900896

901897
export type SignInProps = RoutingOptions & {
902898
/**

0 commit comments

Comments
 (0)
Please sign in to comment.