Adjust new task button to create new task#4063
Adjust new task button to create new task#4063TheodoreSpeaks wants to merge 3 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@BugBot review |
PR SummaryMedium Risk Overview The sidebar task list logic is updated to inject/remove this Reviewed by Cursor Bugbot for commit 2913b67. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 5 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2913b67. Configure here.
| const isCurrentRoute = task.id !== 'new' && pathname === task.href | ||
| const isRenaming = taskFlyoutRename.editingId === task.id | ||
| const isSelected = task.id !== 'new' && selectedTasks.has(task.id) | ||
| const isSelected = |
There was a problem hiding this comment.
Collapsed sidebar allows actions on draft placeholder tasks
Medium Severity
The sidebar isn't consistently recognizing placeholder tasks (like new drafts). This means action buttons and context menus are incorrectly available for these tasks in the collapsed sidebar, which could lead to attempts at server-side operations on non-existent tasks. Also, the isCurrentRoute check still uses task.id !== 'new', potentially misidentifying placeholder tasks as the current route.
Reviewed by Cursor Bugbot for commit 2913b67. Configure here.
| label: 'Home', | ||
| icon: Home, | ||
| href: `/workspace/${workspaceId}/home`, | ||
| onClick: handleNewTaskFromNav, |
There was a problem hiding this comment.
Home button now creates draft task on every click
Medium Severity
The Home nav item now has onClick: handleNewTaskFromNav, which calls createDraft() and then router.push on every regular click. This transforms the "Home" navigation button into a task-creation button — any time a user clicks Home (without modifier keys), a draft task placeholder is inserted into the sidebar. Previously, Home simply navigated to /home. The PR title indicates the intent is to adjust the "New task" button, not repurpose the Home button.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2913b67. Configure here.
| const isCurrentRoute = task.id !== 'new' && pathname === task.href | ||
| const isRenaming = taskFlyoutRename.editingId === task.id | ||
| const isSelected = task.id !== 'new' && selectedTasks.has(task.id) | ||
| const isSelected = |
There was a problem hiding this comment.
isCurrentRoute check not updated for draft task IDs
Low Severity
Both the collapsed (line 1478) and expanded (line 1501) sidebar compute isCurrentRoute using task.id !== 'new' instead of !isPlaceholderTask(task.id). Draft tasks with href pointing to /home will match as the current route when the user is on that page, receiving active styling inconsistent with their placeholder treatment everywhere else. The original 'new' placeholder was deliberately excluded from route matching.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 2913b67. Configure here.
| const handleNewTaskFromNav = useCallback(() => { | ||
| flushSync(() => useDraftTaskStore.getState().createDraft()) | ||
| router.push(`/workspace/${workspaceId}/home`) | ||
| }, [router, workspaceId]) |
There was a problem hiding this comment.
Three identical draft-creation handlers are redundant
Low Severity
handleNewTaskFromNav, tasksPrimaryAction.onSelect, and handleNewTask all contain identical logic: calling flushSync with createDraft() then router.push to home. Two of these are useCallback wrappers with the same deps. tasksPrimaryAction.onSelect could reference handleNewTask, and handleNewTaskFromNav could be eliminated entirely in favor of handleNewTask, reducing the maintenance surface for this logic from three copies to one.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 2913b67. Configure here.
| } | ||
| } | ||
| prevFetchedTaskIdsRef.current = currentIds | ||
| }, [draftTaskId, fetchedTasks]) |
There was a problem hiding this comment.
Draft removed prematurely on cold-start task load
Medium Severity
prevFetchedTaskIdsRef is initialized via useRef with fetchedTasks, which defaults to [] on a cold cache. Since useRef only captures the mount-time value, the ref starts as an empty set. When the initial task list loads, every task satisfies !prevFetchedTaskIdsRef.current.has(t.id), so hasNewTask becomes true and removeDraft() fires — even though none of those tasks correspond to the user's draft. The draft placeholder briefly appears then vanishes. The same false-positive occurs if an unrelated user creates a task in a shared workspace.
Reviewed by Cursor Bugbot for commit 2913b67. Configure here.


Summary
Brief description of what this PR does and why.
Fixes #(issue)
Type of Change
Testing
How has this been tested? What should reviewers focus on?
Checklist
Screenshots/Videos