Skip to content

Commit

Permalink
Update handling for array of tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Feb 18, 2025
1 parent d616a7f commit 639e7f8
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/clerk-js/src/ui/components/PendingTask/PendingTask.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useSessionContext } from '@clerk/shared/react/index';
import type { SessionTasks } from '@clerk/types';
import type { SessionTask } from '@clerk/types';
import type { ComponentType } from 'react';
import { withRedirectToAfterSignIn } from 'ui/common';

import { Route } from '../../../ui/router';
import { OrganizationList } from '../OrganizationList';

const paths: Record<keyof SessionTasks, string> = {
const paths: Record<SessionTask['key'], string> = {
orgs: 'select-organization',
};

const TaskRegistry: Record<keyof SessionTasks, ComponentType> = {
const TaskRegistry: Record<SessionTask['key'], ComponentType> = {
orgs: OrganizationList,
};

Expand All @@ -21,10 +21,7 @@ function usePendingTask() {
return null;
}

const [pendingTask] = Object.entries(session.tasks ?? {}).map(([task, value]) => ({
task,
...value,
}));
const [pendingTask] = session.tasks ?? [];

return pendingTask;
}
Expand All @@ -37,8 +34,7 @@ export function _PendingTask() {
}

const Task = TaskRegistry['orgs'];
// @ts-ignore
const path = paths[pendingTask.task];
const path = paths[pendingTask.key];

return (
<Route path={path}>
Expand Down

0 comments on commit 639e7f8

Please sign in to comment.