Skip to content

Fix 1447#1448

Merged
arnestrickmann merged 2 commits intogeneralaction:mainfrom
prath47:fix-1447
Mar 12, 2026
Merged

Fix 1447#1448
arnestrickmann merged 2 commits intogeneralaction:mainfrom
prath47:fix-1447

Conversation

@prath47
Copy link
Contributor

@prath47 prath47 commented Mar 12, 2026

Summary

The bug was in TitlebarContext.tsx — it was reading task list from selectedProject.tasks which is always [] in this architecture (tasks are stored separately in React Query, not embedded in the project object)

Fixes

Fixes #1447

Snapshot

image

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (does not change functionality, e.g. code style improvements, linting)
  • This change requires a documentation update

Mandatory Tasks

  • I have self-reviewed the code
  • A decent size PR without self-review might be rejected

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project (pnpm run format)
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my PR needs changes to the documentation
  • I have checked if my changes generate no new warnings (pnpm run lint)
  • I have added tests that prove my fix is effective or that my feature works
  • I haven't checked if new and existing unit tests pass locally with my changes

@vercel
Copy link

vercel bot commented Mar 12, 2026

@prath47 is attempting to deploy a commit to the General Action Team on Vercel.

A member of the Team first needs to authorize it.

@prath47
Copy link
Contributor Author

prath47 commented Mar 12, 2026

@arnestrickmann please check this out

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 12, 2026

Greptile Summary

This PR fixes a bug (#1447) where the task dropdown in the titlebar always appeared empty. The root cause was that TitlebarContext was reading tasks from selectedProject?.tasks, but in this codebase tasks are never embedded in the project object — they are fetched and cached separately via React Query (one query per project, keyed by ['tasks', project.id]) inside useTaskManagement.

Changes:

  • TitlebarContext.tsx: Adds a required tasks: Task[] prop and removes the incorrect const tasks = selectedProject?.tasks ?? [] derivation.
  • Titlebar.tsx: Extracts tasksByProjectId from useTaskManagementContext() and passes the correctly sourced tasksByProjectId[selectedProject.id] ?? [] down to TitlebarContext.

The fix is minimal, well-scoped, and correctly leverages the existing React Query data layer. TitlebarContext is only rendered in one place (Titlebar.tsx), so the breaking interface change (adding the required tasks prop) has no other impact.

Confidence Score: 5/5

  • This PR is safe to merge — it is a targeted, low-risk bug fix with no side effects.
  • The change is minimal (removing one line, adding one prop), correctly traces the data flow from React Query through the context to the component, and TitlebarContext is consumed in exactly one place so the interface change cannot cause regressions elsewhere.
  • No files require special attention.

Important Files Changed

Filename Overview
src/renderer/components/titlebar/TitlebarContext.tsx Removed the stale selectedProject?.tasks ?? [] local derivation and replaced it with an explicit tasks: Task[] prop, correctly sourcing task data from the caller rather than the project object.
src/renderer/components/titlebar/Titlebar.tsx Extracts tasksByProjectId from useTaskManagementContext() and forwards the correct per-project task list to TitlebarContext, resolving the empty task dropdown bug.

Sequence Diagram

sequenceDiagram
    participant TM as useTaskManagementContext
    participant TB as Titlebar
    participant TBC as TitlebarContext

    note over TM: tasksByProjectId built<br/>from React Query cache

    TB->>TM: destructure { activeTask, handleSelectTask, tasksByProjectId }
    TB->>TB: compute tasks = tasksByProjectId[selectedProject.id] ?? []
    TB->>TBC: pass tasks, selectedProject, activeTask, onSelectProject, onSelectTask
    TBC->>TBC: render project + task dropdowns using tasks[]

    note over TBC: Before fix: const tasks = selectedProject?.tasks ?? []<br/>(always [] — not stored on project object)
    note over TBC: After fix: tasks prop sourced from React Query via Titlebar
Loading

Last reviewed commit: 28159b6

@arnestrickmann
Copy link
Contributor

Thanks, Prath! @prath47

@arnestrickmann arnestrickmann merged commit 6c5d7ca into generalaction:main Mar 12, 2026
3 of 4 checks passed
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.

[bug]: Not able to see task name in title

2 participants