feat: add support for preserving page title on refresh #22972
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



This pull request enhances the handling of page titles for views annotated with
@PreserveOnRefreshin Vaadin applications. The main improvement is ensuring that when a view's title is updated at runtime, the new title is correctly preserved and restored after a browser refresh. This is achieved by extending the preserved view state to include the page title, updating it when necessary, and adding new tests to verify the behavior.Preserved View Title Handling:
PreservedViewData) to store the page title alongside the view chain and location, replacing the previous use ofPair. [1] [2]AbstractNavigationStateRendererso that when a preserved view is restored after refresh, its title is also restored if available.updatePreservedChainTitle, to update the preserved title in the session when the UI title changes, and invoked this method fromUIInternals.setTitle. [1] [2]Testing and Validation:
PreserveOnRefreshTitleView) and integration test (PreserveOnRefreshTitleIT) to verify that title updates are preserved across browser refreshes for views with@PreserveOnRefresh. [1] [2]setPreservedChainsignature with title support and to validate the correct restoration and purging of preserved chains. [1] [2] [3] [4] [5]These changes ensure a consistent and expected user experience when navigating and refreshing pages with preserved views.
Fixes #22201
🤖 Created with Claude