Skip to content

Commit ce7dcd9

Browse files
committed
Fix reviewing invalidating the cache
1 parent 2020b7e commit ce7dcd9

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

src/browser/components/pr-overview.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,16 @@ export const PROverview = memo(function PROverview() {
263263
}
264264
}, [github, owner, repo, pr.number, commentText, store]);
265265

266+
const handleCommentKeyDown = useCallback(
267+
(e: React.KeyboardEvent) => {
268+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
269+
e.preventDefault();
270+
handleAddComment();
271+
}
272+
},
273+
[handleAddComment]
274+
);
275+
266276
const handleUpdateBranch = useCallback(async () => {
267277
await store.updateBranch();
268278
}, [store]);
@@ -1270,6 +1280,7 @@ export const PROverview = memo(function PROverview() {
12701280
<MarkdownEditor
12711281
value={commentText}
12721282
onChange={setCommentText}
1283+
onKeyDown={handleCommentKeyDown}
12731284
placeholder="Add your comment here..."
12741285
minHeight="100px"
12751286
/>

src/browser/contexts/pr-review/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,10 @@ export class PRReviewStore {
17361736
this.set({ reviews });
17371737
};
17381738

1739+
setTimeline = (timeline: TimelineEvent[]) => {
1740+
this.set({ timeline });
1741+
};
1742+
17391743
setPr = (pr: PullRequest) => {
17401744
this.set({ pr });
17411745
};

src/browser/contexts/pr-review/useReviewActions.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,18 @@ export function useReviewActions() {
6262
files_reviewed: state.viewedFiles.size,
6363
});
6464

65-
// Refresh comments and reviews
66-
const [newComments, reviews] = await Promise.all([
65+
// Invalidate timeline cache so we get fresh data
66+
github.invalidateCache(`pr:${owner}/${repo}/${pr.number}:timeline`);
67+
68+
// Refresh comments, reviews, and timeline
69+
const [newComments, reviews, timeline] = await Promise.all([
6770
github.getPRComments(owner, repo, pr.number),
6871
github.getPRReviews(owner, repo, pr.number),
72+
github.getPRTimeline(owner, repo, pr.number),
6973
]);
7074
store.setComments(newComments as ReviewComment[]);
7175
store.setReviews(reviews);
76+
store.setTimeline(timeline);
7277

7378
// If we got the review ID from REST, use it; otherwise find the latest review
7479
let scrollTarget: string | undefined;

0 commit comments

Comments
 (0)