Urgent.News

What's breaking now, across thousands of outlets.

Tech

Navigation 3: You Own the Back Stack Now. Here’s How Not to Leak It

Navigation 3 hands you the back stack as plain state. There is no controller to ask, no graph to inflate, no hidden NavBackStackEntry lifecycle you can only observe. You hold a list, you mutate the list, and the UI follows. That is freedom. It is also a whole new class of bugs, because every guarantee the old library enforced quietly (one entry per destination, cleanup on pop, restoration after…

Navigation 3 gives you direct access to the back stack as plain state. There's no controller to consult, no graph to inflate, and no hidden lifecycle you can only observe. You possess a list, you alter the list, and the UI automatically adapts. This newfound freedom comes with a whole new set of potential bugs, as all the assurances that the old library quietly enforced (one entry per destination, cleanup on pop, restoration after process death) are now your responsibility.

This article examines five key areas where developers commonly encounter problems: modeling nested flows, restoring after process death, scoping ViewModels, predictive back, and identifying leaks before they affect users. The mental model: a list of keys and a function. Nav3 consists of two main components. The keys are compact, immutable values that define the user's current location. A NavDisplay converts this list of keys into UI via an entry provider.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Tuesday 17 November →