docs: document that navigating to the shown view does nothing - #25629
Merged
mcollovati merged 2 commits intoSep 11, 2026
Conversation
Both UI.navigate and Router.navigate skip a navigation to the location that is already shown, so the view is not re-instantiated and no navigation lifecycle event fires. The javadoc said the opposite: every navigate(Class, ...) overload documented its return value as "the view instance, if navigation actually happened", while the Optional holds the view that was already shown. refreshCurrentRoute(boolean), the method that does rebuild it, was not mentioned anywhere near navigate. The test pins both halves of the documented contract: navigating twice returns the same instance, and refreshCurrentRoute replaces it. Part of #25580
Collaborator
Author
Type of change
Javadoc only, so there is nothing to exercise by hand: the review is Note This covers option 1 of item 1 in #25580 only. Whether |
mcollovati
marked this pull request as ready for review
September 10, 2026 10:16
|
Contributor
caalador
approved these changes
Sep 11, 2026
mcollovati
deleted the
issues/25580-make_refreshCurrentRoute_more_visible
branch
September 11, 2026 06:37
vaadin-bot
added a commit
that referenced
this pull request
Sep 11, 2026
… (CP: 25.3) (#25656) This PR cherry-picks changes from the original PR #25629 to branch 25.3. --- #### Original PR description > Part of #25580 > > **DX/docs** · flow-server · everyone who navigates to the view that is > already shown > > Navigating to the view that is already shown does nothing, and the > javadoc promised the opposite: it said the return value tells you > whether the navigation happened, when it never does. Anyone who wanted > the view rebuilt had no way to find the method that rebuilds it. Both > are documented now; behaviour is unchanged. > > **Risks:** > - ✅ Javadoc only, plus one test that pins the documented behaviour: no > behaviour change, no API change, nothing deprecated. > > **Context.** The skip prevents navigation loops, because a `BeforeEnter` > reroute and the client history sync go through the same call, so the > behaviour stays as it is and only the javadoc was wrong. > `refreshCurrentRoute(boolean)` already does the rebuild that was asked > for. > > - Documented on all nine `UI.navigate` overloads that navigating to the > location that is already shown does nothing: the view is not > re-instantiated, no navigation lifecycle event fires, and > `refreshCurrentRoute(boolean)` is the way to rebuild it. > - Corrected `@return` on the seven overloads that return an `Optional`. > It said "the view instance, if navigation actually happened"; the > `Optional` holds the view that was already shown when the navigation > was skipped, and is empty when a reroute or a forward went elsewhere. > - Added the reciprocal cross-reference on `refreshCurrentRoute(boolean)`, > which now says it is the way to rebuild the view that is currently > shown and links back to `navigate`. > - Added `UITest` coverage: navigating twice to the same target returns > the same instance, and `refreshCurrentRoute(false)` replaces it. > Co-authored-by: Marco Collovati <marco@vaadin.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Part of #25580
DX/docs · flow-server · everyone who navigates to the view that is
already shown
Navigating to the view that is already shown does nothing, and the
javadoc promised the opposite: it said the return value tells you
whether the navigation happened, when it never does. Anyone who wanted
the view rebuilt had no way to find the method that rebuilds it. Both
are documented now; behaviour is unchanged.
Risks:
behaviour change, no API change, nothing deprecated.
Context. The skip prevents navigation loops, because a
BeforeEnterreroute and the client history sync go through the same call, so the
behaviour stays as it is and only the javadoc was wrong.
refreshCurrentRoute(boolean)already does the rebuild that was askedfor.
UI.navigateoverloads that navigating to thelocation that is already shown does nothing: the view is not
re-instantiated, no navigation lifecycle event fires, and
refreshCurrentRoute(boolean)is the way to rebuild it.@returnon the seven overloads that return anOptional.It said "the view instance, if navigation actually happened"; the
Optionalholds the view that was already shown when the navigationwas skipped, and is empty when a reroute or a forward went elsewhere.
refreshCurrentRoute(boolean),which now says it is the way to rebuild the view that is currently
shown and links back to
navigate.UITestcoverage: navigating twice to the same target returnsthe same instance, and
refreshCurrentRoute(false)replaces it.