Skip to content

v1.0.0-rc-002

Compare
Choose a tag to compare
@AngelMunoz AngelMunoz released this 14 Nov 02:18
· 7 commits to vnext since this release

We've went through a major refactoring during rc-1 to rc-2, the public API didn't change too much but it did had some breaking changes for most of the projects however Navs required some serious refactorings in order to simplify the routing logic.

Navs

The most important breaking change in navs is the removal of children nested routes from the route definitions, we don't really have a reason to provide a nested route component, neither exposed a public API that allowed consumer s to analyze the route graphs, the whole nested children was making the route resolution and navigation extremely complicated, we will revisit nested routes in v2 if there's enough interest in the feature

Added

  • IDisposableBag - In the case of Avalonia (and it could be useful for others as well) registering disposables per route is something quite useful specially when you deal with subscriptions to observables or even monitoring adaptive values via callbacks. The disposable bag will be disposed after a successful deactivation of a route AND if the view is not cached Just remember to call definiion |> Route.cache NoCache when you want to ensure you dispose of objects when a view is unloaded.
  • RouteContext.addDisposable - ease of access method to add disposables

Navs Breaking changes

  • Rename method Router.get to Router.build
  • RouteDefinition<'View>.children is not available anymore, please source the nested views to a flattened route list
  • Guards
    • Guard signatures have changed, RouteContext voption -> RouteContext -> CancellationToken is the new signature, the first context represents the current activated route (if any) and the second context is the desired route if the guard is successful
    • Guards lost the INavigable<'View> parameter, you can now return a Redirect "/next/destination" with the desired route instead please keep in mind that the redirection support is not yet in this release, it will be added in the next rc.

Full Changelog: v1.0.0-rc-001...v1.0.0-rc-002