diff --git a/src/views/pending-post/__tests__/pending-post.test.tsx b/src/views/pending-post/__tests__/pending-post.test.tsx index f56070f6..e9d6d93b 100644 --- a/src/views/pending-post/__tests__/pending-post.test.tsx +++ b/src/views/pending-post/__tests__/pending-post.test.tsx @@ -133,6 +133,22 @@ describe('PendingPost', () => { expect(testState.navigateMock).not.toHaveBeenCalledWith('/not-found', { replace: true }); }); + it('does not register the scroll helper return value as an effect cleanup', async () => { + scrollToMock.mockReturnValueOnce({}); + testState.accountCommentIndex = '0'; + testState.accountComments = [{}]; + testState.post = { + communityAddress: 'music-posting.eth', + }; + + await renderPendingPost(); + + expect(() => { + act(() => root.unmount()); + }).not.toThrow(); + root = createRoot(container); + }); + it('passes normalized numeric-string pending indices to the account comment lookup', async () => { testState.accountCommentIndex = '01'; testState.accountComments = [{}, {}]; diff --git a/src/views/pending-post/pending-post.tsx b/src/views/pending-post/pending-post.tsx index 28b856af..836b720d 100644 --- a/src/views/pending-post/pending-post.tsx +++ b/src/views/pending-post/pending-post.tsx @@ -61,7 +61,9 @@ const PendingPost = () => { const isRetryingThisPendingPost = retryingAccountCommentIndex !== null && retryingAccountCommentIndex === normalizedAccountCommentIndex; const lastPendingBoardRef = useRef<{ accountCommentIndex: number; boardPath: string } | null>(null); - useEffect(() => window.scrollTo(0, 0), []); + useEffect(() => { + window.scrollTo(0, 0); + }, []); useEffect(() => { if (typeof normalizedAccountCommentIndex === 'number' && pendingBoardPath) {