flow-and-components-documentation
flow-and-components-documentation copied to clipboard
Explain the difference between `rerouteTo` and `forwardTo`
trafficstars
The https://vaadin.com/docs/v14/flow/routing/tutorial-routing-lifecycle.html#rerouting docs doesn't help: the docs for forward and rerouteTo are almost identical.
The BeforeEnterEvent's javadoc doesn't explain the difference at all also:
rerouteTo(): Reroutes the navigation to show the given component instead of the component that is currently about to be displayed.forwardTo(): Forward the navigation to show the given component instead of the component that is currently about to be displayed.
The same thing, just 'forward' instead of 'reroutes'.
Update the documentation to mention the difference between the two.
Just guessing: could it be that rerouteTo updates the browser's URL while forwardTo does not?
Yes:
rerouteTo()doesn't change the browser's URLforwardTo()also changes the browser's URL