Skip to content

fix(mobile): restore native search text after navigation - #4711

Open
saphid wants to merge 5 commits into
pingdotgg:mainfrom
saphid:fix/sidebar-search-filter-navigation
Open

fix(mobile): restore native search text after navigation#4711
saphid wants to merge 5 commits into
pingdotgg:mainfrom
saphid:fix/sidebar-search-filter-navigation

Conversation

@saphid

@saphid saphid commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Synchronize the iOS Mail-style search toolbar with the retained React search query.
  • Restore the retained text and native clear affordance after navigating back to Threads.
  • Apply the same existing helper contract to Threads, Archived Threads, and Files search.
  • Add a focused regression test and update only the required patched-dependency hash references.

Why

Reproduction

  1. In the iOS mobile app, search Threads for Sidebar.
  2. Open a matching thread.
  3. Navigate back to Threads.

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 createNativeMailSearchToolbarItem helper owns the iOS-only patched react-native-screens Mail toolbar contract. It forwarded change events but not the current query value, while the native patch recreated both its UISearchBar and fallback UISearchTextField empty.

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

  • The retained filter intentionally stays active across navigation.
  • Existing search-change callbacks and clear behavior are unchanged.
  • Threads, Archived Threads, and Files use their existing query state.
  • Android, web, ordering, filtering semantics, persistence, server APIs, and navigation contracts are unchanged.
  • No adjacent cleanup or dependency version change is included.

UI Changes

Before — origin/main

The list remains filtered after navigating back, but the native field appears empty and exposes no clear button.

Before: retained filter hidden after returning to Threads

After — this PR

The retained query is restored visibly and the native clear button remains available.

After: retained Sidebar query and clear button visible

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.
  • Integrated: iPhone 17 Pro, iOS 26.5 Simulator, T3 Code Dev development variant — search Sidebar → 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 — Codex gpt-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 is 7fa67cead70254339a7724b6ca95e9d6d3e8e564.

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 earlier size:L label was caused by unrelated peer-resolution churn in pnpm-lock.yaml; that churn has been removed. The lockfile now changes only seven required react-native-screens patch-hash references.

Risks and limitations

  • Risk edges exercised: retained non-empty text after navigation, native clear affordance, and restoration of the full list.
  • The native patch assigns the value to both the UISearchBar and fallback UISearchTextField paths.
  • Android was not run because this path is iOS-specific and Android continues to use its existing platform search primitives.
  • Local swiftlint, ktlint, and detekt were unavailable, so pnpm lint:mobile reported those checks as skipped rather than passed. The repository's macOS CI installs that toolset.
  • Local Node was 24.12.0 while the repository declares 24.13.1; focused tests, typecheck, formatting, lint, and frozen install still completed successfully.
  • EAS Preview is expected to skip unless the deployment label is applied.
  • The Vercel marketing authorization context is an external-fork authorization gate and does not exercise this mobile change.
  • Safe rollback: revert this single commit.

Checklist

  • PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for UI changes
  • I included a video for the interaction change
  • Branch contains no unrelated, generated, personal, or private files
  • Every stated validation result maps to current evidence

Note

Restore native search text in iOS mail-style toolbar after navigation

  • Updates createNativeMailSearchToolbarItem to accept a value string and map it to searchText on the returned toolbar item, so callers can control the visible search text.
  • Patches react-native-screens to wire searchText through to UISearchBar/UISearchTextField, excluding it from the toolbar identity so the same instance updates as text changes.
  • Passes the current search query as value in 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.

createNativeMailSearchToolbarItem now requires a value and maps it to native searchText. Home, Archived Threads, and Files pass their current searchQuery into that helper.

The react-native-screens patch reads searchText when building the toolbar, sets it on both UISearchBar and fallback UISearchTextField, and always shows the clear button. Toolbar reuse no longer keys off searchText, 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.

@coderabbitai

coderabbitai Bot commented Jul 28, 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: 6d05ed8d-2360-47c3-8e6d-a0458a759c4f

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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:L 100-499 changed lines (additions + deletions). labels Jul 28, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 28, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@saphid
saphid force-pushed the fix/sidebar-search-filter-navigation branch from 85cc917 to 4d68772 Compare July 28, 2026 07:34
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 28, 2026 07:34

Dismissing prior approval to re-evaluate 4d68772

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jul 28, 2026

saphid commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@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 size:M; all repository CI jobs pass, with only the unrelated external-fork Vercel authorization context remaining.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 28, 2026
@saphid
saphid force-pushed the fix/sidebar-search-filter-navigation branch from 4d68772 to 7fa67ce Compare July 28, 2026 21:31

@t3-code t3-code Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this branch currently conflicts with main, so the merged result cannot be reviewed yet. please resolve the conflict and refresh the branch for a final pass.

@macroscopeapp
macroscopeapp Bot dismissed their stale review August 13, 2026 16:43

Dismissing prior approval to re-evaluate 052cd75

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 13, 2026
Comment thread patches/react-native-screens@4.25.2.patch
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant