Skip to content

fix(mobile): add recyclingKey to PR review comment avatars - #6091

Open
iscekic wants to merge 1 commit into
mainfrom
kwf/surface-the-mobile-app-apps-da40
Open

fix(mobile): add recyclingKey to PR review comment avatars#6091
iscekic wants to merge 1 commit into
mainfrom
kwf/surface-the-mobile-app-apps-da40

Conversation

@iscekic

@iscekic iscekic commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Changelog for users

  • A recycled PR review discussion row no longer flashes the previous commenter's avatar before the new author's avatar loads.

Changelog for maintainers

  • The discussion comment avatar sets recyclingKey to the author's avatar URL and keeps size, transition, and cache policy unchanged.
  • Expo Image can keep a cached source in the view while a FlashList cell is rebound to a different comment, which produced the stale avatar frame.
  • The no-avatar fallback still renders the plain muted circle; the new key applies only to the image branch.
  • The existing CommentRow test file gains a case that renders an author avatar URL and asserts the image's recyclingKey.
  • Review hint: the new test matches the first host node typed Image; tighten the selector if another image renders above the avatar.

E2E proof

Owner request

Surface: the mobile app (apps/mobile).

Problem

On the PR review Discussion tab, comment author avatars render inside a FlashList whose rows are recycled. apps/mobile/src/components/pr-review/discussion/pr-review-discussion-list.tsx renders CommentRow for every kind: 'comment' item from a FlashList (see its renderItem at lines 138-152). apps/mobile/src/components/pr-review/discussion/comment-row.tsx lines 232-240 render the avatar as:

<Image
  source={{ uri: comment.author.avatarUrl }}
  className="size-6 rounded-full"
  transition={0}
  cachePolicy="memory"
  accessibilityIgnoresInvertColors
/>

There is no recyclingKey. Expo Image documents this prop as: "Changing this prop resets the image view content to blank or a placeholder before loading and rendering the final image. This is especially useful for any kinds of recycling views like FlashList to prevent showing the previous source before the new one fully loads." With cachePolicy="memory" the previous commenter's avatar can render for a frame when a cell is recycled onto a different comment. The repository already sets this prop on the other recycled images (apps/mobile/src/components/agents/markdown-image.tsx:266 uses recyclingKey={uri} and apps/mobile/src/components/agents/attachment-preview-strip.tsx:302 uses recyclingKey={attachment.id}), so the comment avatar is the outlier.

Requested behavior

Set recyclingKey={comment.author.avatarUrl} on the avatar Image in comment-row.tsx so a recycled discussion row clears the previous image before loading the new author's avatar. Do not change any other prop, layout, copy, or behavior.

Evidence

  • apps/mobile/src/components/pr-review/discussion/comment-row.tsx:232-240 — avatar Image without recyclingKey.
  • apps/mobile/src/components/pr-review/discussion/pr-review-discussion-list.tsx:132-152 — the owning FlashList (with getItemType={item => item.kind}) recycles comment rows.
  • Expo Image recyclingKey reference: https://docs.expo.dev/versions/latest/sdk/image/ (recyclingKey: resets the view before loading the new source; especially useful for FlashList).
  • FlashList v2 usage guidance: https://shopify.github.io/flash-list/docs/usage/ (recycling model: rows are rebound with new item data rather than destroyed).

Scope and exclusions

  • Only the avatar in comment-row.tsx changes. No dependency changes, no new surface, no schema change, no copy change.
  • Do not touch Kilo Claw (apps/mobile/src/app/**/kiloclaw/**, apps/mobile/src/components/kiloclaw/**, apps/mobile/src/lib/kiloclaw/**) or the (1_kiloclaw) routes.
  • Keep the fix shared across Android and iOS; recyclingKey is supported on both.

Acceptance checks

  1. A unit test at apps/mobile/src/components/pr-review/discussion/comment-row.test.tsx (create it if it does not already exist) renders CommentRow with an author avatar URL and asserts the rendered Image receives recyclingKey equal to that URL. This must fail before the change and pass after it.
  2. From apps/mobile/: pnpm typecheck, pnpm lint, pnpm format:check, pnpm check:unused, and pnpm test all pass.
  3. Local end-to-end proof through the normal workflow on both iOS and Android: open a PR Discussion with at least 30 comments from at least 5 distinct authors, fling the list hard, and record the screen. Count frames where a row's avatar belongs to a different author than the login beside it; the recording must show zero such frames (before the change it may show at least one). Require the recording; screenshots are the fallback if recording is unavailable.
  4. No other PR-review behavior, layout, or copy changes.

Prerequisites for the checks

  • A reachable PR review Discussion fixture with the comment volume and author variety above for the E2E run.
  • The normal mobile E2E workflow running the backend and Metro.

Notes

  • The queued workflow implements this after classification.

Surface: the mobile app (apps/mobile).

# Problem

On the PR review Discussion tab, comment author avatars render inside a FlashList whose rows are recycled. `apps/mobile/src/components/pr-review/discussion/pr-review-discussion-list.tsx` renders `CommentRow` for every `kind: 'comment'` item from a `FlashList` (see its `renderItem` at lines 138-152). `apps/mobile/src/components/pr-review/discussion/comment-row.tsx` lines 232-240 render the avatar as:

```tsx
<Image
  source={{ uri: comment.author.avatarUrl }}
  className="size-6 rounded-full"
  transition={0}
  cachePolicy="memory"
  accessibilityIgnoresInvertColors
/>
```

There is no `recyclingKey`. Expo Image documents this prop as: "Changing this prop resets the image view content to blank or a placeholder before loading and rendering the final image. This is especially useful for any kinds of recycling views like FlashList to prevent showing the previous source before the new one fully loads." With `cachePolicy="memory"` the previous commenter's avatar can render for a frame when a cell is recycled onto a different comment. The repository already sets this prop on the other recycled images (`apps/mobile/src/components/agents/markdown-image.tsx:266` uses `recyclingKey={uri}` and `apps/mobile/src/components/agents/attachment-preview-strip.tsx:302` uses `recyclingKey={attachment.id}`), so the comment avatar is the outlier.

# Requested behavior

Set `recyclingKey={comment.author.avatarUrl}` on the avatar `Image` in `comment-
@kilo-code-bot

kilo-code-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The change adds recyclingKey={comment.author.avatarUrl} to the PR review comment avatar and a focused test; it matches existing recycled-image patterns in the app, and the added prop introduces no memory-leak, logic, or type-safety concerns.

Files Reviewed (2 files)
  • apps/mobile/src/components/pr-review/discussion/comment-row.tsx
  • apps/mobile/src/components/pr-review/discussion/comment-row.test.tsx

Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

@iscekic iscekic added the human-ready The PR is ready for human review. label Sep 11, 2026
@iscekic iscekic self-assigned this Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

human-ready The PR is ready for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant