Skip to content

Commit 05b02ce

Browse files
committed
fix(web): a comment link missing from cached activity rereads the host
activityQuery.refresh() reads the server's activity cache again, so a comment posted after that cache filled was still missing and the link settled without showing it. The single retry now invalidates the host cache first, through the panel's existing refreshFromHost.
1 parent 8603cfc commit 05b02ce

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

‎apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -585,24 +585,6 @@ export function PullRequestDetailPanel({
585585
!activityQuery.isPending
586586
? activityQuery.dataUpdatedAt
587587
: null;
588-
const revealRefreshedFor = useRef<string | null>(null);
589-
const showRevealedComment = useEffectEvent(() => {
590-
if (revealCommentId === null) {
591-
// Cached activity can predate the comment, so load it once more before giving up.
592-
if (revealUrl !== undefined && revealRefreshedFor.current !== revealUrl) {
593-
revealRefreshedFor.current = revealUrl;
594-
return activityQuery.refresh();
595-
}
596-
return onRevealSettled?.();
597-
}
598-
// selectTab's store writes; the local tab already switched during render.
599-
if (tabOnPage) useGuideRunStore.getState().showPageDetailTab(guideKey, "summary");
600-
onTabChange?.("summary");
601-
});
602-
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- the tab and the pending link live in stores outside the panel
603-
useEffect(() => {
604-
if (revealCommentId !== null || revealMissedAt !== null) showRevealedComment();
605-
}, [revealCommentId, revealMissedAt]);
606588
const refreshDetail = () => {
607589
detailQuery.refresh();
608590
activityQuery.refresh();
@@ -659,6 +641,24 @@ export function PullRequestDetailPanel({
659641
appliedForcedToken.current = forcedRefreshToken;
660642
refreshFromHostOnRequest();
661643
}, [forcedRefreshToken]);
644+
const revealRefreshedFor = useRef<string | null>(null);
645+
const showRevealedComment = useEffectEvent(() => {
646+
if (revealCommentId === null) {
647+
// Cached activity can predate the comment, so read the host once more before giving up.
648+
if (revealUrl !== undefined && revealRefreshedFor.current !== revealUrl) {
649+
revealRefreshedFor.current = revealUrl;
650+
return void refreshFromHost();
651+
}
652+
return onRevealSettled?.();
653+
}
654+
// selectTab's store writes; the local tab already switched during render.
655+
if (tabOnPage) useGuideRunStore.getState().showPageDetailTab(guideKey, "summary");
656+
onTabChange?.("summary");
657+
});
658+
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- the tab and the pending link live in stores outside the panel
659+
useEffect(() => {
660+
if (revealCommentId !== null || revealMissedAt !== null) showRevealedComment();
661+
}, [revealCommentId, revealMissedAt]);
662662
const runAction = useAtomCommand(pullRequestEnvironment.runAction, {
663663
reportFailure: false,
664664
});

0 commit comments

Comments
 (0)