feat: add @RouteParent annotation#24444
Conversation
Introduces com.vaadin.flow.router.RouteParent for declaring the conceptual parent of a @route view. Consumed by external navigation components (e.g. breadcrumbs) that need to walk route ancestry without inferring it from URL prefixes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
| @Target(ElementType.TYPE) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Documented | ||
| public @interface RouteParent { |
There was a problem hiding this comment.
General question: Should RouteParent have a second or third parameter for informations like Query or Route Parameter? e.g.: Home -> Categories -> category/fruits (or category=fruits)-> Apples
There was a problem hiding this comment.
RouteParent only defines parent view and all path related information is in the routes itself. e.g. for building a breadcrumb, current view already has knowledge of query and route parameters via RouterState.
There was a problem hiding this comment.
Yeah.. but I'm talking about the parent :) in my example Categories would be the top most parent, afterwards the parent would be the Category: Fruits and the current page would be Apples.
There was a problem hiding this comment.
There was a problem hiding this comment.
Similar breadcrumb would work without defining any RouteParent:
route: /categories/:category/:product
Route params: category=fruits, product=apples
breadcrumb: Categories -> fruits -> apples
With RouteParent one can shorten it up:
route: /categories/:category/:product
RouteParent: categories view
Route params: category=fruits, product=apples
breadcrumb: Category: Fruits -> apples
|
Closing in favor of #24550 |



Summary
com.vaadin.flow.router.RouteParent— a class-level annotation declaring the conceptual parent of a@Routeview.Test plan
mvn -pl flow-server test -Dtest=RouteParentTest— 4 reflection tests pass@ParentLayoutvs@RouteParentdistinction🤖 Generated with Claude Code