fix(mobile): a link during video playback no longer rebuilds the open thread #34990
main fromrefs/pull/34990/head·merged by juliusmarminge View on GitHubOn iPhone, opening a video from a thread and then receiving a link to that thread closes the video and rebuilds the thread, losing your place. The link can come from a notification tap, a deep link or a share. Related to #33998, which I haven't confirmed this fixes; see "Not checked" below.
Why it happens#
V5CardStackView records the top card as being popped by native Back (nativePopSource, mirrored into nativelyPoppingRoute) whenever that card gets onWillDisappear. A full-screen presentation like the video player also fires onWillDisappear, and the event carries no reason. So the whole time the video plays, the thread is marked as leaving. When SELECT_WORKSPACE_DETAIL runs in that time, it won't reuse a card it believes is leaving. It builds a new Thread route, so the old card is popped and a new one pushed under the player, and the player closes when its route goes away.
Fix#
Native Back reveals the card beneath, and that card gets onWillAppear before the top card's onDidDisappear. A presentation covers the top card without revealing anything in this stack. So a card that finishes disappearing while no other card appeared is no longer treated as popping, and the pop source is cleared. Native Back, cancelled swipes and JS navigation keep their current behavior.
This is one small, focused fix for an obvious state bug in a single component, plus one test.
Evidence#
Reproduction on an iOS 27 simulator, debug dev client:
- Open a thread.
- Open a video from a file link in it.
- While it plays, open
t3code-dev://threads/<environmentId>/<threadId>for the same thread. This is the action a notification tap dispatches.
Router log, which was temporary instrumentation and isn't in this PR:
before: SELECT_WORKSPACE_DETAIL {"popping":"yvnnCF","before":["Home:VG8kdF","Thread:yvnnCF"],"after":["Home:VG8kdF","Thread:NEW"]}
rootState {"index":1,"routes":["Home:VG8kdF","Thread:cwIsqH"]} <- new thread key, video closed
after: SELECT_WORKSPACE_DETAIL {"popping":null,"before":["Home:i5Au6m","Thread:0xuN4T"],"after":["Home:i5Au6m","Thread:0xuN4T"]}
rootState {"index":1,"routes":["Home:i5Au6m","Thread:0xuN4T"]} <- same key, video still playing
The screenshot is taken 3 s after the link arrives:

Test: apps/mobile/src/native/createV5StackNavigator.ios.test.tsx fires the native screen events at V5CardStackView. A covered card must clear the pop source, and native Back, where the card beneath appears, must keep it. It fails on main ("expected last call to have been called with [ null ]") and passes with the fix.
vp test run src/native/createV5StackNavigator.ios.test.tsx # 1 passed
vp run check:changed # format, lint, knip, typecheck, test, react compiler: pass
Manual regression checks on the simulator with the fix all behaved as before:
- the header Back button
- a full edge swipe back
- a cancelled short swipe, which stays on the thread
- swiping back after closing the video
- reopening the thread
- cold start, then a failed video open, then a real video, then Back, repeated
Not checked#
- iPad split view. The collapsed-split path uses
collapsedSplitTransitionand is unchanged. - A physical device.
- The ~0.4 s while the player animates in, between
onWillDisappearandonDidDisappear. The card is still marked as popping then, so a link landing in exactly that window can still rebuild it. Closing that needs the native stack to report why a card is disappearing. - The original #33998 symptom, where the list appears pushed on top of the thread after the player closes. I haven't reproduced it. This defect shares the same stale pop source, but I can't confirm it's the cause.
Written with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
13a85fdMacroscope's review found this PR approvable — The change distinguishes full-screen presentations from native Back navigation so opening a link during video playback does not rebuild the open thread. Its effects are limited to transient iOS navigation state, with no product-default or persistent-data changes.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
The iOS stack navigator and collapsed-split projection now track whether another screen appeared during a disappearance. The navigator and projection use that state to determine whether to clear the leaving route. Tests cover both transition outcomes.
Changes: iOS transition tracking
Layer / File(s) Summary Collapsed-split disappearance tracking
apps/mobile/src/native/workspace-stack-projection.ts,apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsx,apps/mobile/src/native/workspace-stack-projection.test.tsThe workspace stack forwards didDisappearevents. The projection tracks whether another screen appeared before the leaving detail disappeared. Tests check that the leaving key is cleared only when no other screen appeared.Native-pop tracking and regression coverage
apps/mobile/src/native/createV5StackNavigator.ios.tsx,apps/mobile/src/native/createV5StackNavigator.ios.test.tsx,apps/mobile/vite.config.tsThe navigator tracks whether a card was revealed and conditionally clears its matching native-pop source when the card disappears. Tests cover a disappearance that reports nulland one that reports the popped Thread route key. The test is added to the React test include list.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
juliusmarminge
Merge Risk:
Minimal · up toa31cf-
The change stops a link to the open thread from rebuilding it while a video presentation is playing on iPhone. Native Back, cancelled swipes and JS navigation keep their existing behavior, and tests cover both disappearance outcomes. No concrete merge-blocking risk was found. iPad split view and physical devices were not manually checked.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: a link received during video playback no longer rebuilds the open thread. The fix in V5CardStackView clears the stale native-pop source when a covered card finishes di… Description check The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the symptom and reproduction. The Change section explains the ro… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the main change: a link received during video playback no longer rebuilds the open thread. The fix in V5CardStackView clears the stale native-pop source when a covered card finishes disappearing. The title says "fix(mobile)" and describes the user-visible symptom, which matches the changeset's purpose. It is a conventional commit title in plain language, as the template asks.
Full details: Description check
-
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section explains the symptom and reproduction. The Change section explains the root cause and the fix. The Scope section says this is a bug fix for an obvious state bug, but it does not link an issue. It links
#33998only as related and unconfirmed, so the author gives no issue that shows this bug directly. The Verification section lists focused test results, manual simulator checks, and items not checked. The description states the reproduction steps, the test command, and the result on main versus the fix. The template also asks for screenshots for UI changes. The author includes a before/after screenshot, but it is hosted on an external release link. The model and harness line is present.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 8bd7f46
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
15ab5363-c25c-48b2-ac0a-216d6a56a52a
Commits-
Reviewing files that changed from the base of the PR and between 78c752537611efe608c2c74436a847b5985c7efb and a31cf4155748c19579c0766bdfb6b69942e04486.
Files selected for processing: 3-
apps/mobile/src/features/layout/createWorkspaceStackNavigator.ios.tsxapps/mobile/src/native/workspace-stack-projection.test.tsapps/mobile/src/native/workspace-stack-projection.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
-
tanstack-source added labelsbug
juliusmarminge added labelstakeover:in-progress
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Evidence#
Real iOS 27.2 app, compact iPhone Duo, 466×678, light theme. Separate fresh databases with identical synthetic replay history.
Steps: scroll to the first turn; open the same-thread link as a no-video control; tap demo.mp4; wait five seconds; open the same-thread link during playback; inspect playback and the thread position after closing any surviving player.
Before After 8bd7f466cc a31cf41557 Recording: player closes and thread jumps to bottom Recording: playback continues; closing returns to the first turn Identical playback driver · Thread seed · App launcher and replay fixture preparation · Reproduction instructions · Synthetic demo video
Not shown:
- A narrow-window iPad was not separately exercised; the recordings use the affected native-column navigator on a compact iPhone Duo.
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged this9db3cb1
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
13a85fdℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.