|
1 | 1 | import { useClerk } from '@clerk/shared/react'; |
2 | 2 | import { eventComponentMounted } from '@clerk/shared/telemetry'; |
3 | 3 | import type { SessionResource } from '@clerk/types'; |
4 | | -import { useContext, useEffect, useRef } from 'react'; |
| 4 | +import { useEffect, useRef } from 'react'; |
5 | 5 |
|
6 | 6 | import { Card } from '@/ui/elements/Card'; |
7 | 7 | import { withCardStateProvider } from '@/ui/elements/contexts'; |
8 | 8 | import { LoadingCardContainer } from '@/ui/elements/LoadingCard'; |
9 | 9 |
|
10 | 10 | import { INTERNAL_SESSION_TASK_ROUTE_BY_KEY } from '../../../core/sessionTasks'; |
11 | | -import { SignInContext, SignUpContext } from '../../../ui/contexts'; |
12 | 11 | import { |
13 | 12 | SessionTasksContext, |
14 | 13 | TaskChooseOrganizationContext, |
@@ -62,19 +61,18 @@ function SessionTasksRoutes(): JSX.Element { |
62 | 61 | ); |
63 | 62 | } |
64 | 63 |
|
| 64 | +type SessionTasksProps = { |
| 65 | + redirectUrlComplete: string; |
| 66 | +}; |
| 67 | + |
65 | 68 | /** |
66 | 69 | * @internal |
67 | 70 | */ |
68 | | -export const SessionTasks = withCardStateProvider(() => { |
| 71 | +export const SessionTasks = withCardStateProvider(({ redirectUrlComplete }: SessionTasksProps) => { |
69 | 72 | const clerk = useClerk(); |
70 | 73 | const { navigate } = useRouter(); |
71 | | - const signInContext = useContext(SignInContext); |
72 | | - const signUpContext = useContext(SignUpContext); |
73 | 74 | const currentTaskContainer = useRef<HTMLDivElement>(null); |
74 | 75 |
|
75 | | - const redirectUrlComplete = |
76 | | - signInContext?.afterSignInUrl ?? signUpContext?.afterSignUpUrl ?? clerk?.buildAfterSignInUrl(); |
77 | | - |
78 | 76 | // If there are no pending tasks, navigate away from the tasks flow. |
79 | 77 | // This handles cases where a user with an active session returns to the tasks URL, |
80 | 78 | // for example by using browser back navigation. Since there are no pending tasks, |
|
0 commit comments