Skip to content

Commit

Permalink
fix(tasks): only display tasks with edits in the drafts menu (#6053)
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanwikner authored Mar 19, 2024
1 parent f70cf04 commit 050f452
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ export function DraftsMenu() {

const draftTasks = useMemo(() => {
if (!user?.id) return []

return data.filter((task) => {
const isAuthoredByUser = task.authorId === user.id
const isDraft = !task.createdByUser
const hasEdits = task._updatedAt !== task._createdAt
const isNotTheTaskBeingCreated = viewMode === 'create' ? task._id !== selectedTask : true
return isAuthoredByUser && isDraft && isNotTheTaskBeingCreated
return isAuthoredByUser && isDraft && isNotTheTaskBeingCreated && hasEdits
})
}, [data, selectedTask, user?.id, viewMode])

Expand Down

0 comments on commit 050f452

Please sign in to comment.