Skip to content

Commit 70fae67

Browse files
author
miko
committed
Shorts: Handle comment notification if opened while on target content page
1 parent cfa033d commit 70fae67

File tree

1 file changed

+11
-4
lines changed
  • ui/page/claim/internal/claimPageComponent/internal/streamClaimPage/internal/shorts

1 file changed

+11
-4
lines changed

ui/page/claim/internal/claimPageComponent/internal/streamClaimPage/internal/shorts/view.jsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,19 @@ export default function ShortsPage(props: Props) {
233233
}
234234
}, [isMobile, doSetShortsSidePanel]);
235235

236+
const handledLinkedCommentIdRef = React.useRef(null);
236237
React.useEffect(() => {
237-
if (linkedCommentId) {
238-
handleCommentsClick();
238+
if (linkedCommentId && linkedCommentId !== handledLinkedCommentIdRef.current) {
239+
handledLinkedCommentIdRef.current = linkedCommentId;
240+
if (isMobile) {
241+
setMobileModalOpen(true);
242+
setPanelMode('comments');
243+
} else {
244+
setPanelMode('comments');
245+
doSetShortsSidePanel(true);
246+
}
239247
}
240-
// eslint-disable-next-line react-hooks/exhaustive-deps
241-
}, []);
248+
}, [linkedCommentId, isMobile, doSetShortsSidePanel]);
242249

243250
React.useEffect(() => {
244251
if (!shortsRecommendedUris || shortsRecommendedUris.length === 0) return;

0 commit comments

Comments
 (0)