File tree Expand file tree Collapse file tree
components/OrganizationProfile Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ export const OrganizationProfileRoutes = (props: PropsOfComponent<typeof Profile
1818 >
1919 < ProfileSettingsPage />
2020 </ Route >
21- < Route path = 'leave' >
21+ < Route
22+ path = 'leave'
23+ flowStart
24+ >
2225 < LeaveOrganizationPage />
2326 </ Route >
2427 < Route index >
@@ -28,7 +31,10 @@ export const OrganizationProfileRoutes = (props: PropsOfComponent<typeof Profile
2831 </ Route >
2932 < Route >
3033 < Switch >
31- < Route path = 'invite-members' >
34+ < Route
35+ path = 'invite-members'
36+ flowStart
37+ >
3238 < InviteMembersPage />
3339 </ Route >
3440 < Route index >
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ type NavigateToFlowStartButtonProps = PropsOfComponent<typeof Button>;
77export const useNavigateToFlowStart = ( ) => {
88 const router = useRouter ( ) ;
99 const navigateToFlowStart = async ( ) => {
10- const to = '/' + router . basePath + router . startPath ;
10+ const to = '/' + router . basePath + router . flowStartPath ;
1111 if ( to !== router . currentPath ) {
1212 return router . navigate ( to ) ;
1313 }
Original file line number Diff line number Diff line change 1- import { pathFromFullPath } from '@clerk/shared' ;
21import React from 'react' ;
32
4- import { trimTrailingSlash } from '../../utils' ;
3+ import { pathFromFullPath , trimTrailingSlash } from '../../utils' ;
54import { newPaths } from './newPaths' ;
65import { match } from './pathToRegexp' ;
76import { RouteContext , useRouter } from './RouteContext' ;
@@ -88,7 +87,9 @@ export function Route(props: RouteProps): JSX.Element | null {
8887 }
8988
9089 const flowStartPath = props . flowStart
91- ? pathFromFullPath ( fullPath ) . replace ( props . path || '' , '' ) || router . flowStartPath
90+ ? //set it as the old full path (the previous step),
91+ //replacing the base path for navigateToFlowStart() to work as expected
92+ pathFromFullPath ( router . fullPath ) . replace ( '/' + router . basePath , '' )
9293 : router . flowStartPath ;
9394
9495 return (
Original file line number Diff line number Diff line change @@ -358,3 +358,7 @@ export const mergeFragmentIntoUrl = (_url: string | URL): URL => {
358358
359359 return mergedUrl ;
360360} ;
361+
362+ export const pathFromFullPath = ( fullPath : string ) => {
363+ return fullPath . replace ( / C L E R K - R O U T E R \/ ( .* ?) \/ / , '' ) ;
364+ } ;
Original file line number Diff line number Diff line change @@ -25,7 +25,3 @@ export function addClerkPrefix(str: string | undefined) {
2525 const stripped = str . replace ( regex , '' ) ;
2626 return `clerk.${ stripped } ` ;
2727}
28-
29- export const pathFromFullPath = ( fullPath : string ) => {
30- return fullPath . replace ( / C L E R K - R O U T E R \/ ( .* ?) \/ / , '' ) ;
31- } ;
You can’t perform that action at this time.
0 commit comments