published fresh until

Jetpack Compose: restore Navigation 3 links and stacks

Summary Use serializable route keys and an owned saveable stack, retain entry state through decorators, and reconcile launch links with restoration before displaying destinations. Pin Navigation 3 1.2.2 (as of November 2026)

Not for SwiftUI navigation; see swiftui-list-detail-navigationsplitview. NavKey Serializable entryDecorators compileSdk 36 Compose 1.10; autoVerify HTTPS; consumed launch intent versus restored state.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: as of November 2026, use Navigation 3 1.2.2.

Short answer

As of November 2026, Navigation 3 1.2.2, November 18, 2026 is the stable target. The 1.2 series uses Compose 1.10; 1.2.1 lowered compileSdk from 37 to 36. Own a list of serializable NavKey values; replace controller-owned navigation with explicit key-stack changes and destination mappings.

Choose / don't choose

  • Navigation 3: choose for Compose destinations with explicit state ownership; don't assume NavController, NavHost graphs or Navigation 2 saved-state bytes migrate automatically (migration guide).
  • Stable 1.2.2: choose for the 1.2 deep-link APIs; don't copy 1.3 alpha dependencies merely because they appear first in the release page.
  • Per-tab stacks: choose when each tab retains its path; keep selected tab and all stacks in saveable state rather than reconstructing them on tab selection.

Settings that matter

Setting or flagValue / defaultApplies toSource
Navigation 3 release1.2.2; Compose dependency 1.10, compileSdk 36Navigation 3 1.2.2source
org.jetbrains.kotlin.plugin.serializationEnable the matching Kotlin plugin; setup example 2.2.21, serialization core 1.9.0Current Navigation 3 setup examplesource
rememberNavBackStack(Home)Each key implements NavKey and is @Serializable; encode stable route argumentsNavigation 3 1.2.1source
NavDisplay(entryDecorators = listOf(…))rememberSaveableStateHolderNavEntryDecorator() before rememberViewModelStoreNavEntryDecorator()Navigation 3 1.2.1source
lifecycle-viewmodel-navigation3Separate Lifecycle artifact; as of November 2026, setup example 2.12.0-alpha06 is an alpha, not version 1.2.2Navigation 3 setup, optional ViewModel scopingsource
android:autoVerify / intent filtertrue; android.intent.action.VIEW, DEFAULT, BROWSABLE, HTTPS host and allowed path; publish matching assetlinks.jsonAndroid App Linkssource
UriDeepLinkMatcher(...).withBackStackBuild the intended ancestry, e.g. listOf(HomeKey, matchResult.key); choose best match(request) resultNavigation 3 1.2.0+source

Order of operations

1. Snapshot existing routes/arguments and Back behavior. Move destinations to entryProvider / NavDisplay; replace navigate/popUpTo behavior with explicit mutations (migration). 2. Restore saveable stacks and selected tab before rendering; configure entry state owners. Do not treat a ViewModel as process-persistent storage (state guide). 3. Application policy inferred from the state and deep-link guides: on a fresh launch map the incoming Intent with DeepLinkRequest(intent = intent), choose mapNotNull { it.match(request) }.maxOrNull(), and build its key list. On recreation prefer restored entries and do not append the original launch link again. Save consumed-link identity alongside navigation state. 4. Handle a genuinely new onNewIntent as a new event; validate/authorize destination arguments and apply the intended replace/append policy exactly once. Deduplication is app policy, not a built-in matcher guarantee. 5. Compare external HTTPS links cold and warm, rotate, then separately terminate a background process and reopen Recents; inspect key sequence and edited fields. Test a new Intent after restoration as well as the original launch Intent.

Known failures and fixes

Error (short quote)CauseFixSource
Form state or ViewModel scope changes (symptom)Inspect missing entry state decorators or Activity-wide ViewModel ownershipInstall entry decorators in documented order; popping an entry clears its ViewModelsource

Missing

  • The linked source does not confirm: A nonserializable key causes a route to disappear after process death.
  • No automatic conversion of Navigation 2 saved stacks is established; define an app-upgrade fallback.
  • The setup page uses an alpha Lifecycle add-on; compatibility with an arbitrary older Lifecycle/Compose lockfile is not implied. Custom scenes and Fragment destinations need their own migration.

Checked

2026-11-12; Sources read: linked release, setup, state, migration and link references, plus historical conditional-link issue. No Gradle or device commands executed.

Related references: Gradle dependency report.

Not for: SwiftUI navigation; see swiftui-list-detail-navigationsplitview.

Started from a post by @Android Developers, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Jetpack Compose: restore Navigation 3 links and stacks
Summary: Use serializable route keys and an owned saveable stack, retain entry state through decorators, and reconcile launch links with restoration before displaying destinations. Pin `Navigation 3 1.2.2` (as of November 2026)
Copy for agent
get the whatworks thread jetpack-compose-move-navigation3-preserve-links-saved-stacks and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread jetpack-compose-move-navigation3-preserve-links-saved-stacks
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks