Skip to content

Conversation

@stunningpixels
Copy link
Contributor

  • View parent tasks, related to a task attempt
  • In kanban identify tasks which have a parent attempt
  • On task panel view parent task attempt
Screenshot 2025-10-22 at 18 42 30 Screenshot 2025-10-22 at 18 42 25 Screenshot 2025-10-22 at 18 42 14 Screenshot 2025-10-22 at 18 42 09

@stunningpixels stunningpixels requested a review from LSRCT October 22, 2025 17:43
If there is a parent task attempt, display a box with summary info about it and allow the user to navigate to that

frontend/src/components/panels/TaskPanel.tsx
If task has a parent task attempt, it should be visible and also easy to navigate to the parent from the kanban card

Let's place an arrow-up icon to the left of the burger menu icon, when there is a parent task attempt. Clicking this should navigate to the task attempt

frontend/src/components/tasks/TaskKanbanBoard.tsx
frontend/src/components/panels/AttemptHeaderActions.tsx

Should be possible to view tasks that have parent_task_attempt set to this task. Similar to frontend/src/components/dialogs/tasks/ViewProcessesDialog.tsx
* Excellent! All checks are passing. Let me create a quick summary of what was changed:

## Summary

I've successfully fixed the related tasks list to show both parent and child tasks. Here's what was changed:

### Changes Made

1. **`frontend/src/hooks/useTaskChildren.ts`**
   - Renamed `useTaskChildren` to `useTaskRelationships` (kept old export for backwards compatibility)
   - Changed return type from `Task[]` to `TaskRelationships`
   - Now returns the full relationships object including `parent_task`, `current_attempt`, and `children`
   - Updated query keys from `taskChildren` to `taskRelationships`

2. **`frontend/src/components/dialogs/tasks/ViewRelatedTasksDialog.tsx`**
   - Updated to use `useTaskRelationships` hook
   - Combines parent and children into a single `relatedTasks` array
   - Now displays both parent and child tasks in the dialog

3. **`frontend/src/hooks/useTaskMutations.ts`**
   - Updated imports to use `taskRelationshipsKeys`
   - Updated cache invalidation comments to reflect "relationships" instead of "children"

### How It Works

The backend endpoint `/api/task-attempts/:id/children` already returns the full `TaskRelationships` object containing:
- `parent_task: Option<Task>` - The parent task (if any)
- `current_attempt: TaskAttempt` - The current attempt being viewed
- `children: Vec<Task>` - Child tasks created by this attempt

The hook now correctly exposes this full object, allowing the UI to display both parent and child tasks as "related tasks".

All TypeScript types check, linting passes, and formatting is correct!

* Perfect! All tasks are complete. Let me create a summary of the final changes:

## Summary

I've successfully fixed the related tasks feature to show both parent and child tasks. Here are the final changes:

### Changes Made

1. **Renamed `frontend/src/hooks/useTaskChildren.ts` → `frontend/src/hooks/useTaskRelationships.ts`**
   - Removed all backwards compatibility aliases
   - Changed return type from `Task[]` to `TaskRelationships`
   - Returns the full relationships object including `parent_task`, `current_attempt`, and `children`
   - Updated query keys from `taskChildren` to `taskRelationships`

2. **Updated `frontend/src/components/dialogs/tasks/ViewRelatedTasksDialog.tsx`**
   - Updated import to use `useTaskRelationships` from the renamed file
   - Combines parent and children into a single `relatedTasks` array
   - Now displays both parent and child tasks in the dialog

3. **Updated `frontend/src/hooks/useTaskMutations.ts`**
   - Updated import path to `@/hooks/useTaskRelationships`
   - Uses `taskRelationshipsKeys` for cache invalidation

### How It Works

The backend endpoint `/api/task-attempts/:id/children` returns a `TaskRelationships` object containing:
- `parent_task: Option<Task>` - The parent task (if exists)
- `current_attempt: TaskAttempt` - The current attempt being viewed
- `children: Vec<Task>` - Child tasks created by this attempt

The hook now correctly returns this full object, allowing the UI to display both parent and children as "related tasks" in the ViewRelatedTasksDialog.

All checks pass:
- ✅ TypeScript compilation
- ✅ ESLint (101 pre-existing warnings, no new ones)
- ✅ Prettier formatting

* Excellent! The change is complete and passes linting.

## Summary

I've updated the navigation behavior for related tasks. When clicking on a related task (parent or child) from the ViewRelatedTasksDialog, the app now navigates to `/attempts/latest` instead of just the task page. This ensures users are taken directly to the latest task attempt, which is the expected behavior throughout the application.

**Changed file:**
- `frontend/src/components/ui/ActionsDropdown.tsx:80` - Updated navigation URL to include `/attempts/latest`
@stunningpixels stunningpixels merged commit 103f556 into main Nov 4, 2025
2 checks passed
@stunningpixels stunningpixels deleted the louis/relationships branch November 4, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants