Skip to content

feat: deprecate HasDynamicTitle in favor of PageTitleGenerator#24606

Open
totally-not-ai[bot] wants to merge 1 commit into
mainfrom
deprecate-hasdynamictitle
Open

feat: deprecate HasDynamicTitle in favor of PageTitleGenerator#24606
totally-not-ai[bot] wants to merge 1 commit into
mainfrom
deprecate-hasdynamictitle

Conversation

@totally-not-ai

Copy link
Copy Markdown
Contributor

HasDynamicTitle resolves a route title from a live instance, so it can
only produce a title for the route currently shown. Guide users towards
DynamicPageTitle together with a PageTitleGenerator, which resolves the
title from the navigation target class and its route parameters without
an instance and therefore also works for routes rendered in breadcrumbs,
menus and other navigation aids.

Deprecate the interface and suppress the resulting warnings in the
internal call sites that still consult it.

HasDynamicTitle resolves a route title from a live instance, so it can
only produce a title for the route currently shown. Guide users towards
DynamicPageTitle together with a PageTitleGenerator, which resolves the
title from the navigation target class and its route parameters without
an instance and therefore also works for routes rendered in breadcrumbs,
menus and other navigation aids.

Deprecate the interface and suppress the resulting warnings in the
internal call sites that still consult it.
* aids. Use this interface only when the title genuinely needs to
* reflect the live state of an already shown view.
*/
@Deprecated(since = "25.3")

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.

Suggested change
@Deprecated(since = "25.3")
@Deprecated(since = "25.2")

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Test Results

 1 447 files  ±0   1 447 suites  ±0   1h 22m 45s ⏱️ - 4m 7s
10 220 tests ±0  10 152 ✅ ±0  68 💤 ±0  0 ❌ ±0 
10 692 runs  ±0  10 623 ✅ ±0  69 💤 ±0  0 ❌ ±0 

Results for commit fb150cb. ± Comparison against base commit 4f1ff37.

@knoobie

knoobie commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

I don't like this deprecation and afterwards removal. We have use-cases where we want to generate the title dynamically once the view was build.

Example: We have an FAQ where the page title contains the question. The user is redirected to the page based on the ID of the question. We execute a costly look-up of the question once and store it as instance variable inside the view. This allows us access question.getTitle() within our HasDynamicTitle method.

Without the view instance this lookup has to be done twice - once for the title and once for the view.

@Artur-

Artur- commented Jun 12, 2026

Copy link
Copy Markdown
Member

Is there a particular reason you want cache it inside the view instance and not in a service layer cache or similar?

@knoobie

knoobie commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Complexity and convenience :) View / Route is the perfect place for such short-living information.

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.

2 participants