diff --git a/apps/mobile/src/components/pr-review/discussion/comment-row.test.tsx b/apps/mobile/src/components/pr-review/discussion/comment-row.test.tsx index c6e6481844..324ce2e56b 100644 --- a/apps/mobile/src/components/pr-review/discussion/comment-row.test.tsx +++ b/apps/mobile/src/components/pr-review/discussion/comment-row.test.tsx @@ -302,3 +302,17 @@ describe('CommentRow overflow actions', () => { renderer.unmount(); }); }); + +describe('CommentRow avatar recycling', () => { + it('sets recyclingKey to the author avatar URL so a recycled row clears the previous image', async () => { + const avatarUrl = 'https://example.com/alice.png'; + const renderer = await render(makeComment({ author: { login: 'alice', avatarUrl } })); + + const image = renderer.root.find( + node => typeof node.type === 'string' && (node.type as string) === 'Image' + ); + expect((image.props as Record).recyclingKey).toBe(avatarUrl); + + renderer.unmount(); + }); +}); diff --git a/apps/mobile/src/components/pr-review/discussion/comment-row.tsx b/apps/mobile/src/components/pr-review/discussion/comment-row.tsx index 18fa553fc4..2a31dcf347 100644 --- a/apps/mobile/src/components/pr-review/discussion/comment-row.tsx +++ b/apps/mobile/src/components/pr-review/discussion/comment-row.tsx @@ -235,6 +235,7 @@ export function CommentRow({ className="size-6 rounded-full" transition={0} cachePolicy="memory" + recyclingKey={comment.author.avatarUrl} accessibilityIgnoresInvertColors /> ) : (