Skip to content

Commit cd0a284

Browse files
fix: fix URL parameter for task (coder#20463)
1 parent f6e86c6 commit cd0a284

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

site/src/pages/TaskPage/TaskPage.stories.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ const meta: Meta<typeof TaskPage> = {
7272
reactRouter: reactRouterParameters({
7373
location: {
7474
pathParams: {
75-
taskId: MockTasks[0].id,
75+
username: MockTask.owner_name,
76+
taskId: MockTask.id,
7677
},
7778
},
78-
routing: { path: "/tasks/:taskId" },
79+
routing: { path: "/tasks/:username/:taskId" },
7980
}),
8081
},
8182
};
@@ -89,6 +90,14 @@ export const LoadingTask: Story = {
8990
() => new Promise(() => {}),
9091
);
9192
},
93+
play: async () => {
94+
await waitFor(() => {
95+
expect(API.experimental.getTask).toHaveBeenCalledWith(
96+
MockTask.owner_name,
97+
MockTask.id,
98+
);
99+
});
100+
},
92101
};
93102

94103
export const LoadingWorkspace: Story = {

site/src/pages/TaskPage/TaskPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ const TaskPageLayout: FC<PropsWithChildren> = ({ children }) => {
5555
};
5656

5757
const TaskPage = () => {
58-
const { task: taskId, username } = useParams() as {
59-
task: string;
58+
const { taskId, username } = useParams() as {
59+
taskId: string;
6060
username: string;
6161
};
6262
const { data: task, ...taskQuery } = useQuery({

0 commit comments

Comments
 (0)