feat: Group tasks by relative date and reorder dependencies#1767
feat: Group tasks by relative date and reorder dependencies#1767jonathanlab wants to merge 2 commits intomainfrom
Conversation
Generated-By: PostHog Code Task-Id: 844c45f7-36dd-4201-b51f-2120c4ee7561
Generated-By: PostHog Code Task-Id: 844c45f7-36dd-4201-b51f-2120c4ee7561
Prompt To Fix All With AIThis is a comment left during a code review.
Path: apps/code/src/renderer/utils/time.ts
Line: 55-56
Comment:
**Redundant conditional — both branches are identical**
Both arms of the ternary produce `new Date(timestamp)`, so the conditional is superfluous. `new Date()` already handles both `string` and `number` inputs, so the whole expression can be collapsed to one line.
```suggestion
const date = new Date(timestamp);
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sidebar/components/TaskListView.tsx
Line: 381-382
Comment:
**Duplicate React keys when same date group appears non-consecutively**
`dateGroupedTasks` only merges *consecutive* tasks that share a label. If `flatTasks` ever has two tasks labelled `"Today"` separated by a `"Yesterday"` entry, two distinct group objects would both carry `label: "Today"`. Using the label alone as the `Fragment` key causes a duplicate-key warning and unpredictable reconciliation. Incorporating the array position into the key avoids this.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "feat(sidebar): group tasks by relative d..." | Re-trigger Greptile |
| const date = | ||
| typeof timestamp === "string" ? new Date(timestamp) : new Date(timestamp); |
There was a problem hiding this comment.
Redundant conditional — both branches are identical
Both arms of the ternary produce new Date(timestamp), so the conditional is superfluous. new Date() already handles both string and number inputs, so the whole expression can be collapsed to one line.
| const date = | |
| typeof timestamp === "string" ? new Date(timestamp) : new Date(timestamp); | |
| const date = new Date(timestamp); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/utils/time.ts
Line: 55-56
Comment:
**Redundant conditional — both branches are identical**
Both arms of the ternary produce `new Date(timestamp)`, so the conditional is superfluous. `new Date()` already handles both `string` and `number` inputs, so the whole expression can be collapsed to one line.
```suggestion
const date = new Date(timestamp);
```
How can I resolve this? If you propose a fix, please make it concise.| {dateGroupedTasks.map((group) => ( | ||
| <Fragment key={group.label}> |
There was a problem hiding this comment.
Duplicate React keys when same date group appears non-consecutively
dateGroupedTasks only merges consecutive tasks that share a label. If flatTasks ever has two tasks labelled "Today" separated by a "Yesterday" entry, two distinct group objects would both carry label: "Today". Using the label alone as the Fragment key causes a duplicate-key warning and unpredictable reconciliation. Incorporating the array position into the key avoids this.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/sidebar/components/TaskListView.tsx
Line: 381-382
Comment:
**Duplicate React keys when same date group appears non-consecutively**
`dateGroupedTasks` only merges *consecutive* tasks that share a label. If `flatTasks` ever has two tasks labelled `"Today"` separated by a `"Yesterday"` entry, two distinct group objects would both carry `label: "Today"`. Using the label alone as the `Fragment` key causes a duplicate-key warning and unpredictable reconciliation. Incorporating the array position into the key avoids this.
How can I resolve this? If you propose a fix, please make it concise.| const date = | ||
| typeof timestamp === "string" ? new Date(timestamp) : new Date(timestamp); |
Tasks in the sidebar task list are now grouped by relative date categories (Yesterday, This week, etc)
Closes #1086
Created with PostHog Code