Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): Stabilize native stack option updates #4037

Mergedjuliusmarmingemerged 6 commits intomain fromrefs/pull/4037/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Extracted from #3910.

Avoids redundant native-stack setOptions updates during busy thread renders, preventing the PreventRemoveProvider maximum-update-depth failure. Includes the matching patched-dependency lockfile update.

Validation inherited from #3910: vp check and mobile native lint passed before the split. The full typecheck is currently blocked in this workspace by unavailable mobile dependencies (expo-blur, expo-quick-actions, and @tabler/icons-react-native).

Note

Stabilize native stack option updates to prevent redundant navigation.setOptions calls

  • Adds optionsSignature to produce a stable string fingerprint of an options object, handling primitives, functions (via source), arrays, and objects with cycle detection and stable key ordering.
  • Adds stabilizeOptionFunctions to replace function-valued options with stable wrapper references that always delegate to the latest implementation, preventing reference churn on re-renders.
  • In NativeStackScreenOptions, computes a signature of the stable options on each render and skips calling navigation.setOptions if the signature matches the previously applied one.
  • Behavioral Change: navigation.setOptions is now a no-op when options are semantically unchanged; function options are passed as persistent wrapper references rather than new closures each render.
Macroscope summarized d73fe59.

Note

Medium Risk Touches navigation header option application and deep option comparison; incorrect signature logic could skip needed updates or mishandle function options, though scope is limited to mobile stack headers.

Overview Fixes maximum update depth failures during busy thread renders by stopping redundant navigation.setOptions calls when screen options are semantically unchanged.

NativeStackScreenOptions now fingerprints options with optionsSignature (primitives, sorted object keys, function source text, refs ignored) and skips setOptions when the fingerprint matches the last applied value. stabilizeOptionFunctions replaces inline header factories with stable wrapper references that still call the latest implementation, so reference churn does not re-trigger the navigator.

The @react-navigation/native-stack patch gains mailSearchToolbar handling in header item processing; pnpm-lock.yaml updates the patched dependency hash.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d73fe594c8d1b933149920f2578501c110fd96ee. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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

      Run ID: a3ce3425-2f1f-4574-9470-3c9c6a9ce047

      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

      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved

      ...

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start. Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f3564666427976ed80cbb142f23f89c31f180fc1. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. apps/mobile/src/native/StackHeader.tsx line 105Resolvedby juliusmarminge
    6. juliusmarminge merged this271454c

    7. juliusmarminge closed this

Sign in to join this conversation.