Skip to content

Commit ce56d7f

Browse files
committed
Fix RedirectToTasks to only redirect to tasks
1 parent 03bbf25 commit ce56d7f

File tree

4 files changed

+4
-32
lines changed

4 files changed

+4
-32
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,7 @@ import {
151151
Organization,
152152
Waitlist,
153153
} from './resources/internal';
154-
import {
155-
INTERNAL_SESSION_TASK_ROUTE_BY_KEY,
156-
navigateIfTaskExists,
157-
warnMissingPendingTaskHandlers,
158-
} from './sessionTasks';
154+
import { getTaskEndpoint, navigateIfTaskExists, warnMissingPendingTaskHandlers } from './sessionTasks';
159155
import { State } from './state';
160156
import { warnings } from './warnings';
161157

@@ -1569,7 +1565,7 @@ export class Clerk implements ClerkInterface {
15691565
return buildURL(
15701566
{
15711567
base: this.buildSignInUrl(),
1572-
hashPath: `/tasks/${INTERNAL_SESSION_TASK_ROUTE_BY_KEY[currentTask.key]}`,
1568+
hashPath: getTaskEndpoint(currentTask),
15731569
},
15741570
{
15751571
stringify: true,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function buildTaskUrl(task: SessionTask, opts: Pick<Parameters<typeof bui
2424
return buildURL(
2525
{
2626
base: opts.base,
27-
hashPath: `/tasks/${INTERNAL_SESSION_TASK_ROUTE_BY_KEY[task.key]}`,
27+
hashPath: getTaskEndpoint(task),
2828
searchParams: params,
2929
},
3030
{ stringify: true },

packages/react/src/components/controlComponents.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,7 @@ export const RedirectToSignUp = withClerk(({ clerk, ...props }: WithClerkProp<Re
167167
}, 'RedirectToSignUp');
168168

169169
export const RedirectToTasks = withClerk(({ clerk }: WithClerkProp) => {
170-
const { session } = clerk;
171-
172170
React.useEffect(() => {
173-
if (!session) {
174-
void clerk.redirectToSignIn();
175-
return;
176-
}
177-
178-
if (!session.currentTask) {
179-
void clerk.redirectToAfterSignIn();
180-
return;
181-
}
182-
183171
void clerk.redirectToTasks();
184172
}, []);
185173

packages/vue/src/components/controlComponents.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,8 @@ export const RedirectToSignUp = defineComponent((props: RedirectOptions) => {
6060
return () => null;
6161
});
6262

63-
export const RedirectToTasks = defineComponent((props: RedirectOptions) => {
64-
const { sessionCtx } = useClerkContext();
65-
63+
export const RedirectToTasks = defineComponent(() => {
6664
useClerkLoaded(clerk => {
67-
if (!sessionCtx.value) {
68-
void clerk.redirectToSignIn(props);
69-
return;
70-
}
71-
72-
if (!sessionCtx.value?.currentTask) {
73-
void clerk.redirectToAfterSignIn();
74-
return;
75-
}
76-
7765
void clerk.redirectToTasks();
7866
});
7967

0 commit comments

Comments
 (0)