Skip to content

feat: add @RouteParent annotation#24444

Closed
web-padawan wants to merge 1 commit into
mainfrom
feat/route-parent-annotation
Closed

feat: add @RouteParent annotation#24444
web-padawan wants to merge 1 commit into
mainfrom
feat/route-parent-annotation

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Summary

  • Adds com.vaadin.flow.router.RouteParent — a class-level annotation declaring the conceptual parent of a @Route view.
  • Consumed by external navigation components (e.g. the upcoming Breadcrumbs Flow integration) that need to walk route ancestry without inferring it from URL prefixes.
  • No existing Flow code reads the annotation yet; this change is purely additive.

Test plan

  • mvn -pl flow-server test -Dtest=RouteParentTest — 4 reflection tests pass
  • Reviewer sanity-checks the Javadoc and the @ParentLayout vs @RouteParent distinction

🤖 Generated with Claude Code

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>
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Test Results

 1 422 files  +1   1 422 suites  +1   1h 20m 22s ⏱️ + 2m 33s
10 014 tests +4   9 946 ✅ +4  68 💤 ±0  0 ❌ ±0 
10 486 runs  +4  10 417 ✅ +4  69 💤 ±0  0 ❌ ±0 

Results for commit a0b458d. ± Comparison against base commit 8978c60.

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RouteParent {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@web-padawan web-padawan marked this pull request as ready for review June 9, 2026 08:21
@web-padawan

Copy link
Copy Markdown
Member Author

Closing in favor of #24550

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants