fix(post): avoid duplicate history entries on OP permalinks

This commit is contained in:
plebeius
2026-03-10 18:25:07 +08:00
parent cd11f1d4df
commit 773debece3
4 changed files with 159 additions and 10 deletions
+6 -5
View File
@@ -42,7 +42,7 @@ import useQuotedByMap from '../../hooks/use-quoted-by-map';
import useProgressiveRender from '../../hooks/use-progressive-render';
import { BOARD_REPLIES_PREVIEW_FETCH_SIZE, BOARD_REPLIES_PREVIEW_VISIBLE_COUNT, REPLIES_PER_PAGE } from '../../lib/constants';
import { filterRepliesForDisplay, getPreviewDisplayReplies } from '../../lib/utils/replies-preview-utils';
import { scrollThreadContainerToTop } from '../../lib/utils/thread-scroll-utils';
import { openThreadAtTop } from '../../lib/utils/thread-scroll-utils';
const { addChallenge } = useChallengesStore.getState();
@@ -256,10 +256,11 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
if (isInPostPageView && !isReply) {
e.preventDefault();
navigate(threadRoute);
scrollThreadContainerToTop(cid);
window.requestAnimationFrame(() => {
scrollThreadContainerToTop(cid);
openThreadAtTop({
cid,
currentPathname: location.pathname,
navigate,
threadRoute,
});
}
};