fix(mobile): restore native search text after navigation - #4711
Conversation
|
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ApprovabilityVerdict: Approved 50ffb4a This is a straightforward bug fix that restores search text in native search bars after navigation. The changes are limited to passing the search query value to the native iOS search component, with a unit test included. Clear intent, limited scope, obvious resolution. You can customize Macroscope's approvability policy. Learn more. |
85cc917 to
4d68772
Compare
Dismissing prior approval to re-evaluate 4d68772
|
@t3dotgg, could you review this focused mobile bug fix when you have a chance? The proof packet, iOS before/after media, interaction video, exact checks, limitations, and owner rationale are complete in the PR body. The branch is now |
4d68772 to
7fa67ce
Compare
Dismissing prior approval to re-evaluate 052cd75
What Changed
Why
Reproduction
Sidebar.Actual
The React query remains active and the list remains filtered, but iOS reconstructs the Mail-style native search toolbar with an empty field. The active filter is therefore hidden and the user has no visible clear affordance.
Expected
The retained query should remain visible after Back, and Clear should restore the full list.
Cause and owner rationale
The existing app-level
createNativeMailSearchToolbarItemhelper owns the iOS-only patchedreact-native-screensMail toolbar contract. It forwarded change events but not the current query value, while the native patch recreated both itsUISearchBarand fallbackUISearchTextFieldempty.This change carries the current value through that existing helper and assigns it at the native control-creation boundary. React remains the source of truth; no downstream inference, reset-on-navigation workaround, protocol change, or new state owner is introduced.
Preserved behavior and exclusions
UI Changes
Before —
origin/mainThe list remains filtered after navigating back, but the native field appears empty and exposes no clear button.
After — this PR
The retained query is restored visibly and the native clear button remains available.
Interaction comparison
The clip shows the upstream behavior followed by the fixed behavior.
sidebar-search-before-after.mp4
Verification
CI=true pnpm install --frozen-lockfile— exit 0; lockfile passed supply-chain policy verification.pnpm exec vp test run apps/mobile/src/features/layout/native-mail-search-toolbar.test.ts— exit 0; 1 file and 1 test passed.pnpm --filter @t3tools/mobile typecheck— exit 0.pnpm exec vp fmt --check <five changed TS/TSX files>— exit 0; all 5 matched files formatted.pnpm exec vp lint --report-unused-disable-directives <five changed TS/TSX files>— exit 0.pnpm lint:mobile— exit 0; found 9 Swift and 12 Kotlin source files.T3 Code Devdevelopment variant — searchSidebar→ open result → Back restored the visible query and clear button → Clear restored the full list./Users/saphid/.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main— Codexgpt-5.6-sol, high reasoning, exit 0; no accepted/actionable findings; TruffleHog scan clean.Scope and size
This is a direct small bug-fix lane using the existing mobile/native owner seam. It does not require a product-direction issue.
The branch was rebased and reverified on current
origin/main(b64ae880e0f88cd35e2f7e1f5fab868546fbe29b); the current head is7fa67cead70254339a7724b6ca95e9d6d3e8e564.The frozen diff is 52 additions and 13 deletions across 7 files. The repository's PR-size algorithm counts 65 effective non-test changed lines, so the expected label is
size:M. An earliersize:Llabel was caused by unrelated peer-resolution churn inpnpm-lock.yaml; that churn has been removed. The lockfile now changes only seven requiredreact-native-screenspatch-hash references.Risks and limitations
UISearchBarand fallbackUISearchTextFieldpaths.swiftlint,ktlint, anddetektwere unavailable, sopnpm lint:mobilereported those checks as skipped rather than passed. The repository's macOS CI installs that toolset.Checklist
Note
Restore native search text in iOS mail-style toolbar after navigation
createNativeMailSearchToolbarItemto accept avaluestring and map it tosearchTexton the returned toolbar item, so callers can control the visible search text.react-native-screensto wiresearchTextthrough toUISearchBar/UISearchTextField, excluding it from the toolbar identity so the same instance updates as text changes.valuein the home, archived threads, and thread files headers so the search field reflects the query after navigation.Macroscope summarized 50ffb4a.
Note
Low Risk
Scoped iOS UI fix on the existing mail-search toolbar path; React remains search state source of truth with a focused unit test.
Overview
Fixes iOS Mail-style search toolbar showing an empty field after navigating back while the list stays filtered.
createNativeMailSearchToolbarItemnow requires avalueand maps it to nativesearchText. Home, Archived Threads, and Files pass their currentsearchQueryinto that helper.The
react-native-screenspatch readssearchTextwhen building the toolbar, sets it on bothUISearchBarand fallbackUISearchTextField, and always shows the clear button. Toolbar reuse no longer keys offsearchText, so query-only updates do not tear down and recreate the native field. A regression test covers the helper mapping.Reviewed by Cursor Bugbot for commit 50ffb4a. Bugbot is set up for automated code reviews on this repo. Configure here.
Implemented and verified with GPT-5.6 Sol (high reasoning) in the Codex harness via T3 Code.