Releases: strblr/typeroute
Releases · strblr/typeroute
v0.12.1
v0.12.0
- Internally, child routes kept a reference to their parent route. This didn't have any practical utility besides a simpler route tree building algorithm in the devtools. In this version, this reference was removed and the devtools algorithm was rewritten to do prefix grouping instead. From the router's perspective, every route is flat and self-contained anyway. The concept of route hierarchy is for route building and not something the router actually sees. The devtools now align with this philosophy.
- Updated docs to remove useless usage of
.route("/"). The resulting route from this call is strictly equivalent to the parent route. The docs now use the parent route directly.
const home = layout.route("/").component(HomePage); // Old
const home = layout.component(HomePage); // Newv0.11.2
v0.11.1
v0.11.0: Merge pull request #7 from strblr/feat-index
- Added new route builder method
.index(). You can now do:
const dashboard = route("/dashboard")
.component(DashboardLayout)
.index(Overview);
const settings = dashboard.route("/settings").component(Settings);
// ...
const routes = [dashboard, settings];Here's what renders for each path:
/dashboard → DashboardLayout > Overview
/dashboard/settings → DashboardLayout > Settings
.index(Comp) is shorthand for .component(() => useOutlet() ?? <Comp />).
v0.10.0
- Router context: you can now pass an arbitrary context to your router and consume it in preloaders. Useful if you need contextual data or instances in preloaders, e.g., a different queryClient for test environments.
<RouterRoot routes={routes} context={{ queryClient }} />;
declare module "@typeroute/router" {
interface Register {
routes: typeof routes;
context: { queryClient: QueryClient };
}
}Handletype now defaults toundefinedinstead ofany, when not registered on theRegisterinterface.
v0.9.0
- You can now pass a routes record to
new Router,RouterRootand module augmentation (previously, only array was possible):
const routes = [home, about];
// Equivalent:
const routes = { home, about };
<RouterRoot routes={routes} />
declare module "@typeroute/router" {
interface Register {
routes: typeof routes;
}
}