fix: preserve client-side navigation for task links (#3844)
This commit is contained in:
@@ -292,7 +292,7 @@ describe("QuickTaskLauncher issue linking", () => {
|
||||
expect(mocks.upsertTaskIssue).toHaveBeenCalledWith(WORKSPACE_ID, link);
|
||||
});
|
||||
expect(mocks.push).toHaveBeenCalledTimes(autoFocus ? 1 : 0);
|
||||
if (autoFocus) expect(mocks.push).toHaveBeenCalledWith("/tasks/task-1");
|
||||
if (autoFocus) expect(mocks.push).toHaveBeenCalledWith("/t/task-1");
|
||||
},
|
||||
);
|
||||
|
||||
@@ -302,7 +302,7 @@ describe("QuickTaskLauncher issue linking", () => {
|
||||
|
||||
mocks.dialogProps?.onSuccess?.({ id: "task-1" } as Task);
|
||||
|
||||
expect(mocks.push).toHaveBeenCalledWith("/tasks/task-1");
|
||||
expect(mocks.push).toHaveBeenCalledWith("/t/task-1");
|
||||
await waitFor(() => expect(mocks.linkTaskIssue).toHaveBeenCalledTimes(1));
|
||||
expect(mocks.upsertTaskIssue).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { useRouter } from "@/lib/routing/client-router";
|
||||
import { linkToTask } from "@/lib/links";
|
||||
import type { Icon } from "@tabler/icons-react";
|
||||
import { TaskCreateDialog } from "@/components/task-create-dialog";
|
||||
import { useAppStore } from "@/components/state-provider";
|
||||
@@ -236,7 +237,7 @@ export function QuickTaskLauncher({
|
||||
});
|
||||
}
|
||||
onClose();
|
||||
if (meta?.autoFocus !== false) router.push(`/tasks/${task.id}`);
|
||||
if (meta?.autoFocus !== false) router.push(linkToTask(task.id));
|
||||
};
|
||||
|
||||
if (!workspaceId || !defaultWorkflow || !defaultStep || !dialog) return null;
|
||||
|
||||
Reference in New Issue
Block a user