fix(mobile): stop the changed files widget from crashing - #7867
fix(mobile): stop the changed files widget from crashing#7867Exotic209093 wants to merge 1 commit into
Conversation
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
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
💡 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 ? ( |
There was a problem hiding this comment.
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" ? ( |
There was a problem hiding this comment.
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 👍 / 👎.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Defensive bug fix that prevents a crash when You can add or adjust custom eligibility rules. Learn more. |
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).
ReviewSheetrenderedresolveNativeReviewDiffView()!with a non-null assertion. That resolver is explicitly designed to returnnull— transiently while Expo registers the native view config, and forever whenrequireNativeView("T3ReviewDiffSurface")throws (native module missing from the installed binary). Mounting a component whose type isnullthrows "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 (useReviewSectionsfalls back toreviewSections[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 byReviewCommentCardinThreadFeed.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()returnsnull(Expo still registering the view, or the native module missing from the binary).ReviewSheetno 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
ReviewSheetcomponent 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.Macroscope summarized f38c5dc.