Migrate the simple mirrored fetched data off PRReviewStore in sub-PRs by data type. Each sub-PR removes one group of fields + their setters + their load orchestration from the store, and switches consumers to the existing React Query hook in src/browser/lib/queries.ts.
Sub-PRs (one commit / one PR each)
pr + files — replace usePRReviewSelector(s => s.pr) and s.files with usePullRequest / usePullRequestFiles. Delete setPr, setFiles, loading, loadingFiles.
reviews + reviewThreads + comments + conversation — swap in usePullRequestReviews, useReviewThreads, usePullRequestComments, usePullRequestConversation. Delete corresponding setters and loading flags.
timeline — swap in usePullRequestTimeline. Delete setTimeline, addTimelineEvent.
commits + pushVersions — swap in usePullRequestCommits, usePullRequestPushVersions. Delete corresponding setters and loadVersionData, versionDataLoaded.
checks + workflowRunsAwaitingApproval + branchDeleted — swap in useChecksByCommit, useWorkflowRunsByCommit, useBranchStatus. Delete setChecks, refreshChecks, getChecksStatus, checksLastUpdated, loadingChecks.
currentUser — swap in useCurrentUser. Delete setCurrentUser. useCurrentUserLoader becomes redundant and is removed.
At the end, loadPRData and loadOverviewData should be empty of fetched-data population and can be deleted or reduced to no-ops.
Optimistic-update conversion
PRReviewStore currently mutates these fields locally for optimistic UX. Every call site of the following methods needs an equivalent queryClient.setQueryData(...) at the same point in the flow:
addPendingComment, removePendingComment, updatePendingCommentBody, updatePendingCommentWithGitHubIds (stays local — pending comments live in the store still, but any read from the RQ comments cache must merge them)
updateComment, deleteComment, addReply — patch pullRequestComments cache entry.
updateReviewThread — patch reviewThreads cache entry.
addConversationComment — patch pullRequestConversation cache entry.
addTimelineEvent — patch pullRequestTimeline cache entry.
Files affected
src/browser/contexts/pr-review/index.tsx — remove fields and methods.
- All 18 consumer files (see tracking issue investigation) — switch selectors to RQ hooks.
src/browser/hooks/useCurrentUserLoader.ts — delete.
Tests
Per sub-PR:
- Test each RQ hook read path in consumers (was previously covered by store fixtures; retarget the same fixtures at the hook wrapped in
QueryClientProvider).
- Test each optimistic
setQueryData conversion: mid-flight cache shape + reconciled post-response shape.
- Delete store-method tests for fields/setters that are gone in that sub-PR.
- End-to-end style: render
pr-review.tsx with mocked network for the migrated data type; confirm optimistic mutations still feel instant and reconcile correctly.
Part of #351
Migrate the simple mirrored fetched data off
PRReviewStorein sub-PRs by data type. Each sub-PR removes one group of fields + their setters + their load orchestration from the store, and switches consumers to the existing React Query hook insrc/browser/lib/queries.ts.Sub-PRs (one commit / one PR each)
pr+files— replaceusePRReviewSelector(s => s.pr)ands.fileswithusePullRequest/usePullRequestFiles. DeletesetPr,setFiles,loading,loadingFiles.reviews+reviewThreads+comments+conversation— swap inusePullRequestReviews,useReviewThreads,usePullRequestComments,usePullRequestConversation. Delete corresponding setters and loading flags.timeline— swap inusePullRequestTimeline. DeletesetTimeline,addTimelineEvent.commits+pushVersions— swap inusePullRequestCommits,usePullRequestPushVersions. Delete corresponding setters andloadVersionData,versionDataLoaded.checks+workflowRunsAwaitingApproval+branchDeleted— swap inuseChecksByCommit,useWorkflowRunsByCommit,useBranchStatus. DeletesetChecks,refreshChecks,getChecksStatus,checksLastUpdated,loadingChecks.currentUser— swap inuseCurrentUser. DeletesetCurrentUser.useCurrentUserLoaderbecomes redundant and is removed.At the end,
loadPRDataandloadOverviewDatashould be empty of fetched-data population and can be deleted or reduced to no-ops.Optimistic-update conversion
PRReviewStorecurrently mutates these fields locally for optimistic UX. Every call site of the following methods needs an equivalentqueryClient.setQueryData(...)at the same point in the flow:addPendingComment,removePendingComment,updatePendingCommentBody,updatePendingCommentWithGitHubIds(stays local — pending comments live in the store still, but any read from the RQ comments cache must merge them)updateComment,deleteComment,addReply— patchpullRequestCommentscache entry.updateReviewThread— patchreviewThreadscache entry.addConversationComment— patchpullRequestConversationcache entry.addTimelineEvent— patchpullRequestTimelinecache entry.Files affected
src/browser/contexts/pr-review/index.tsx— remove fields and methods.src/browser/hooks/useCurrentUserLoader.ts— delete.Tests
Per sub-PR:
QueryClientProvider).setQueryDataconversion: mid-flight cache shape + reconciled post-response shape.pr-review.tsxwith mocked network for the migrated data type; confirm optimistic mutations still feel instant and reconcile correctly.Part of #351