Recipe: synchronize Browser and system Back

luastra/navigation · luastra/host · navigation.history · about 20 minutes

Keep typed Luau navigation, the visible fragment URL, Browser Back, and platform Back on one validated route stack.

You will open #/detail, return with Browser Back, and delegate a platform Back intent to history or root exit.

Every app-owned push writes both the canonical location and encoded router state. Every host-owned history event validates that state before rendering it.

Do not call router.back() and Host.systemBackHistory for the same Back press. The host history event will restore the router after the platform moves Back.

Detail pages

1. Create the project2. Replace luastra.json3. Replace src/main.luau4. Replace tests/smoke.luau5. Check and run6. Understand the arbitration