fix(ui): decouple OpenPrsSection from parent via context#1503
Merged
arnestrickmann merged 1 commit intomainfrom Mar 16, 2026
Merged
fix(ui): decouple OpenPrsSection from parent via context#1503arnestrickmann merged 1 commit intomainfrom
arnestrickmann merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryDecouples
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/renderer/components/OpenPrsSection.tsx | Replaces onReviewPr prop with handleOpenExternalTask from context; clean decoupling with no leftover references. |
| src/renderer/components/ProjectMainView.tsx | Removes onReviewPr prop from OpenPrsSection usage; minimal and correct change. |
| src/renderer/hooks/useTaskManagement.ts | Adds handleOpenExternalTask with optimistic cache upsert + background refetch; wraps handleSelectTask in useCallback with correct dependencies. |
| src/renderer/lib/taskListCache.ts | New upsertTaskInList utility: matches by id or path, preserves position on update, prepends on insert. Clean immutable implementation. |
| src/test/renderer/taskListCache.test.ts | Good test coverage for insert, update-by-id, and update-by-path scenarios in upsertTaskInList. |
Sequence Diagram
sequenceDiagram
participant User
participant OpenPrsSection
participant ElectronAPI
participant TaskManagementContext
participant ReactQueryCache
participant Database
User->>OpenPrsSection: Click "Review" on PR
OpenPrsSection->>ElectronAPI: githubCreatePullRequestWorktree()
ElectronAPI-->>OpenPrsSection: { success, task/worktree }
OpenPrsSection->>TaskManagementContext: handleOpenExternalTask(task)
TaskManagementContext->>ReactQueryCache: upsertTaskInList (optimistic)
TaskManagementContext->>TaskManagementContext: handleSelectTask(task)
TaskManagementContext->>ReactQueryCache: invalidateQueries (background)
ReactQueryCache->>Database: refetch tasks
Database-->>ReactQueryCache: reconciled task list
Last reviewed commit: 1bf5442
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
onReviewPrprop fromOpenPrsSection, replacing it withhandleOpenExternalTaskfromTaskManagementContexthandleOpenExternalTasktouseTaskManagementhook which upserts the task into the cache before selecting it, preventing stale/missing task list entrieshandleSelectTaskinuseCallbackfor stable referenceupsertTaskInListutility to safely insert or update a task in the cached task list (with matching by id or path)Test plan
upsertTaskInListcover insert, update-by-id, and update-by-path scenarios