Router & route model
Base path, locale prefix and explicit route context now live in one coherent flow.
Contract
Only async routes remain
The route loader always receives a RouteContext and always returns a Future[AbstractComponent]. There is no second synchronous API surface to drift away anymore.
parent
/scalajs-ui/router
locale
/de or /en
load
Future[AbstractComponent]
URL
Browser path stays human
The router strips base path and locale for matching, then restores both for history updates.
Context
Route data is explicit
Loaders get path params, locale, browserPath and query params as a plain value.
Hydration
Async loaders keep SSR content
Pending route loaders adopt the server-rendered range and replace it after completion.
Nested route demo
The button activates a child route. Its component appears below through the parent's routerOutlet().
Current route shape
The demo uses the same API as downstream applications would.
scala
Route.view(
"/router",
children = Seq(
Route.view("user/:id") { context =>
Future.successful(Route.component {
RouterUserPage.render(context)
})
}
)
) { _ =>
Future.successful(Route.component {
RouterPage.render() // contains Router.routerOutlet()
})
}