Skip to content

Commit 94b4ad6

Browse files
committed
fix: UI link
1 parent 3381120 commit 94b4ad6

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/discussions/posts/post/PostLink.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,17 @@ const PostLink = ({
5454
// For comments/responses, show parent thread title with arrow
5555
const displayTitle = (type === 'response' || type === 'comment') && threadTitle ? threadTitle : title;
5656

57+
// Strip render_id suffix (e.g., "-thread", "-response", "-comment") for navigation
58+
const stripRenderIdSuffix = (idValue) => {
59+
if (typeof idValue === 'string') {
60+
return idValue.replace(/-(thread|response|comment)$/, '');
61+
}
62+
return idValue;
63+
};
64+
5765
// For comments/responses, navigate to the parent thread instead of the comment itself
58-
const navigationPostId = (type === 'response' || type === 'comment') && commentThreadId ? commentThreadId : postId;
66+
const rawNavigationId = (type === 'response' || type === 'comment') && commentThreadId ? commentThreadId : postId;
67+
const navigationPostId = stripRenderIdSuffix(rawNavigationId);
5968

6069
const { pathname } = discussionsPath(Routes.COMMENTS.PAGES[page], {
6170
0: enableInContextSidebar ? 'in-context' : undefined,

0 commit comments

Comments
 (0)