reactiveui / reactiveui/Sextant
Routing API revamp RFC
@RLittlesII is already working on this.
Since Sep 1, 2018.
- Dominant language
- C#
- Stars
- 161
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
I just started experimenting with routing (UWP app), so while I have fresh eyes, some thoughts:
Rename RoutingState to Router
"Routing state" implies a container of state data rather than a class responsible for navigation actions. "Router" seems a better name for a class that actually handles routing. This is further reinforced by the fact that even on the IScreen interface, the RoutingState property name is "Router". IMO, Router is both more apt and concise.
Formalize navigation stack into a class
Today, we have a handful of commands hanging off RoutingState along with a ObservableCollection called "NavigationStack" (note that here it's not even a stack in the data structures sense of the term). It would be better to introduce a new class, NavigationStack with the following signature:
public class NavigationStack
{
ReactiveCommand<Unit> Advance { get; }
ReactiveCommand<Unit> Backtrack { get; }
IRoutableViewModel Current { get; }
}
This would leave no ambiguity about what the commands do. If there is value in it, the class can implement ObservableCollection to enable subscribing to notifications. Router would then have a read-only property named NavigationStack.
Replace the Navigate command with method + property
Is there value in Navigate being a command? Writing router.Navigate.Execute(vm) feels clunky. Would be better to have Navigate be a method, and have a companion Navigating observable property on Router. Another benefit is that the method can have an (optional) bool reset attribute, thus letting us drop the NavigateAndReset command on Router.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.