Skip to content

[Due for payment 2026-04-28] [$250] iOS crash: Infinite onboarding navigation loop (Maximum update depth exceeded) #88018

Description

@mountiny

Problem

Users on iOS production are hitting an infinite navigation loop crash during the onboarding flow. The app crashes with "Maximum update depth exceeded" (React error).

Sentry issue: https://expensify.sentry.io/issues/7332234716/

Symptoms

  • Rapid, repeated navigation to OnboardingModalNavigator visible in Sentry breadcrumbs
  • VL logs show [OnboardingGuard] Redirecting to onboarding route firing repeatedly with all boolean conditions as empty strings (serialized false/undefined)
  • Not reproducible locally — appears to require a specific timing/state combination

Root Cause

The OnboardingGuard in src/libs/Navigation/guards/OnboardingGuard.ts lacks idempotency. When shouldSkipOnboarding is false, the guard unconditionally returns a REDIRECT to the onboarding route — even when the user is already on the OnboardingModalNavigator.

Each REDIRECT produces a CommonActions.reset() that changes the navigation state, which triggers:

  1. onStateChange in NavigationRoot.tsx → Onyx writes (updateOnboardingLastVisitedPath)
  2. Re-renders from Onyx state changes
  3. Re-evaluation of the guard (via useNavigationBuilder calling router.getStateForAction during render)
  4. Another REDIRECT → another reset → loop continues until React hits maximum update depth

Additionally, getOnboardingInitialPath() (called by the guard to compute the redirect route) performs Onyx.set() side effects for certain user types (VSB, SMB, individual), which injects further state mutations into each loop iteration.

Fix

Add an idempotency check: if OnboardingModalNavigator is already present in state.routes, return ALLOW instead of issuing a redundant REDIRECT. This ensures the guard reaches a stable state after the first redirect.

Platform

  • iOS
  • Android
  • Web
  • Desktop
  • Mobile Web
Issue OwnerCurrent Issue Owner: @mallenexpensify
Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022044575911073373513
  • Upwork Job ID: 2044575911073373513
  • Last Price Increase: 2026-04-16

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions