Skip to content

Tabs & preserved state

A tabbed shell is a tabs(...) node with one branch per tab. Each branch owns an independent RouteStack, so the tabs are parallel, not a single stack.

Feed tab
Feed → Note(2) → Note(3)
Settings tab
Settings → Profile
switching tabs preserves each stack — you return exactly where you were

Branches are rendered in an IndexedStack, built lazily (a tab’s Navigator is created the first time it’s shown) and then kept alive — so scroll positions and form state survive tab switches. Each tab gets its own HeroController.

Here’s the subtle part. When a platform URL change arrives — a browser back/forward, or a deep link — raku_router does not rebuild the tree from scratch. It reconciles in place:

browser back → /feed/notes/2
active tab follows the URL
+
other tabs untouched
unchanged screens keep their element state; inactive tabs keep their history

So on the web, the browser’s back/forward replays your URL history (you land on the right screen, in order) and the rest of the app keeps its state — not a rebuilt-from-scratch tree.

A single URL can only encode the active path. So a cold deep link (opening a URL fresh) starts the other tabs at their initial route — no router can carry every branch’s divergent history in one URL. Within a session, everything is preserved.