# ballast


11/01/2023, 8:57 PM
While working on navigation, I stumbled on this way to completely clear out the navigation backstack via a router input:
Copy code
RouterContract.Inputs.PopUntilAnnotation(inclusive = true, annotation = Tag(""))
Maybe this could be provided as a predefined Input? E.g.
or something similar.

Casey Brooks

11/02/2023, 2:59 PM
Unlike the convention for most ballast VM Contracts, the RouterContract intentionally uses an abstract (not sealed) class to represent Inputs, so you can create your own and directly update the backstack however you need. Here’s an example from the BallastNavigationExt library showing how simple this is. For this particular Input, though, I’m not quite sure I understand the user-case for completely clearing the backstack. I would expect that you should clear it only to the first entry, or else exit the application (which, maybe that’s what you’re trying to do with a ClearBackstack input?). I’m not opposed to adding new Routing Inputs if they’re generally-useful, so maybe you can help me understand more about this one. But it may also be better for you to just create your own Input types that better represent your application’s unique navigation logic


11/02/2023, 3:08 PM
or else exit the application
That’s exactly my intention. Thanks for pointing out the library project, I’ll make sure to check it out. 🙏