Skip to content

fix(mobile): stop the changed files widget from crashing - #7867

Open
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/mobile-changed-files-crash
Open

fix(mobile): stop the changed files widget from crashing#7867
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/mobile-changed-files-crash

Conversation

@Exotic209093

@Exotic209093 Exotic209093 commented Aug 22, 2026

Copy link
Copy Markdown

Problem

Opening a thread whose agent has made file changes crashes the iPhone app the moment the changed files / diff widget appears, and every reopen of that chat crashes again, permanently burning it (#7800).

ReviewSheet rendered resolveNativeReviewDiffView()! with a non-null assertion. That resolver is explicitly designed to return null — transiently while Expo registers the native view config, and forever when requireNativeView("T3ReviewDiffSurface") throws (native module missing from the installed binary). Mounting a component whose type is null throws "Element type is invalid", which is a fatal JS exception in release builds. Because the review section for a thread auto-selects from persisted turn checkpoints (useReviewSections falls back to reviewSections[0]), reopening the chat re-renders the same screen and crashes again.

Fix

Null-check the resolver in ReviewSheet, matching the defensive pattern already used by ReviewCommentCard in ThreadFeed.tsx. When the native diff surface is unavailable, the sheet now degrades to rendering the raw patch instead of crashing; the "Changed files" navigator (a plain virtualized FlatList) still renders.

Fixes #7800

ox-alpha via opencode


Note

Low Risk
Small defensive UI change in the mobile review sheet. It avoids a fatal render crash and does not alter auth, data handling, or native module behavior.

Overview
Stops the review sheet from crashing when resolveNativeReviewDiffView() returns null (Expo still registering the view, or the native module missing from the binary).

ReviewSheet no longer non-null-asserts the resolver. If the native surface is unavailable, it shows a selectable raw patch instead of mounting a null component type. The changed-files navigator still renders.

Reviewed by Cursor Bugbot for commit f38c5dc. Configure here.

Note

Fix crash in mobile changed files widget when native diff view is unavailable

The ReviewSheet component crashed when a files-kind diff rendered but the native diff view failed to resolve. The non-null assertion on the resolved view is replaced with a nullable variable, and the conditional now checks for both a files-kind diff and a non-null view.

  • Adds a fallback branch for files-kind diffs that renders a notice and the raw patch text when the native diff view is unavailable.
  • Risk: users who previously saw a crash will now see raw patch text instead of the native diff UI in the fallback case.

Macroscope summarized f38c5dc.

ReviewSheet force-unwrapped resolveNativeReviewDiffView(), which is
documented to return null while Expo registers the native view config
and forever after a failed requireNativeView (e.g. a binary without
the T3ReviewDiffSurface module). Rendering a null component type throws
"Element type is invalid", which is fatal in release builds: the app
crashes the moment the diff widget appears, and since the thread's
review section auto-selects from persisted checkpoints, every reopen
crashes again and the chat is burned.

Null-check the resolver like ThreadFeed's ReviewCommentCard already
does, and fall back to showing the raw patch when the native surface
is unavailable.

Fixes pingdotgg#7800

ox-alpha via opencode
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0954214e-bb14-4349-a7c1-a02ff215278c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 22, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f38c5dca05

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/>
</View>
) : selectedSection && parsedDiff.kind === "files" ? (
) : selectedSection && parsedDiff.kind === "files" && NativeReviewDiffView ? (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable the changed-files navigator in raw fallback mode

When resolveNativeReviewDiffView() returns null for an older or incompletely registered binary, showChangedFilesPane still registers ReviewFileNavigator. Selecting a file updates the row's selected state, but handleSelectFile only calls nativeReviewDiffViewRef.current?.scrollToFile(...); the ref is necessarily null in this branch, and the raw patch is neither scrolled nor filtered. The navigator therefore presents working controls that cannot navigate, so either hide it when the native view is unavailable or connect it to the fallback renderer.

Useful? React with 👍 / 👎.

</Text>
</ScrollView>
</View>
) : parsedDiff.kind === "files" ? (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore a refresh action for the iOS fallback

On iOS when the native view is unavailable, this branch renders a plain ScrollView, but the iOS toolbar has no refresh action because refresh is normally provided only through the native surface's onPullToRefresh; the explicit "Refresh current diff" menu is Android-only. Users on the affected iOS binaries therefore cannot refresh a working-tree or branch diff while remaining in the review screen. Add a RefreshControl or expose the toolbar refresh action in fallback mode.

Useful? React with 👍 / 👎.

@macroscopeapp

macroscopeapp Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f38c5dc

Macroscope's review found this PR approvable — Defensive bug fix that prevents a crash when resolveNativeReviewDiffView() returns null, adding a graceful fallback to display raw patch text. Changes are self-contained with clear intent. The open comments suggest UX polish for the fallback mode but don't challenge the core fix.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Changed files widget crashes iPhone Mobile app

1 participant