Open task after creating (vibe-kanban) (#184)
* Perfect! I've successfully implemented the feature to automatically open a task in the sidebar after creation. The change was made to the [`handleCreateTask` function in project-tasks.tsx](file:///private/var/folders/kr/jdxkcn7129j376nrg0stj9zm0000gn/T/vibe-kanban/vk-f5e5-open-task/frontend/src/pages/project-tasks.tsx#L152-L168). Now when users create a task using the "Create Task" button, it will automatically navigate to the task details view in the sidebar, making it consistent with the "Create & Start" button behavior that already had this functionality. * prettier
This commit is contained in:
committed by
GitHub
parent
f98088dd5c
commit
ed781b552a
@@ -152,17 +152,21 @@ export function ProjectTasks() {
|
|||||||
const handleCreateTask = useCallback(
|
const handleCreateTask = useCallback(
|
||||||
async (title: string, description: string) => {
|
async (title: string, description: string) => {
|
||||||
try {
|
try {
|
||||||
await tasksApi.create(projectId!, {
|
const createdTask = await tasksApi.create(projectId!, {
|
||||||
project_id: projectId!,
|
project_id: projectId!,
|
||||||
title,
|
title,
|
||||||
description: description || null,
|
description: description || null,
|
||||||
});
|
});
|
||||||
await fetchTasks();
|
await fetchTasks();
|
||||||
|
// Open the newly created task in the details panel
|
||||||
|
navigate(`/projects/${projectId}/tasks/${createdTask.id}`, {
|
||||||
|
replace: true,
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError('Failed to create task');
|
setError('Failed to create task');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[projectId, fetchTasks]
|
[projectId, fetchTasks, navigate]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleCreateAndStartTask = useCallback(
|
const handleCreateAndStartTask = useCallback(
|
||||||
|
|||||||
Reference in New Issue
Block a user