-
Notifications
You must be signed in to change notification settings - Fork 193
Description
Description of the bug
Calling UI.getcurrent().refreshCurrentRoute() is supposed to rebuild the current route-target and optionally the whole layout-chain, see parameter refreshRouteChain, but if I use it to refresh a route that triggers a redirect (forward/reroute) in beforeEnter() vaadin seems to discard any new created route-component (including layouts) and reuse previous.
I think the problem is, that in
com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.forward(NavigationEvent, BeforeEvent) and com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.reroute(NavigationEvent, BeforeEvent)
the flags "forceInstantiation" and "recreateLayoutChain" of the current NavigationEvent aren't propagated to the new NavigationEvent created by
com.vaadin.flow.router.internal.AbstractNavigationStateRenderer.getNavigationEvent(NavigationEvent, BeforeEvent)
Expected behavior
The route-chain should also be refreshed/recreated if a redirect was triggered inside beforeEnter() of the route-target.
Minimal reproducible example
- Start the Project & open in Browser
- Click "Option 1"
Attributes in the Session are set:
- test_attribute = value shown in header/appbar
- redirect = flag evaluated in beforeEnter() to trigger redirect
and then refreshCurrentRoute(true) is called (true = refreshRouteChain)
Expected:
header/appbar shows h2 with text "OPTION 1" but nothing shows
Button "Option 2" shows how it should work (= shows Text "OPTION 2" in header/appbar) but without redirects.
Versions
- Vaadin / Flow version: 24.6.5
- Java version: 17
- OS version: Windows 11
- Browser version (if applicable): Version 132.0.6834.160 (Offizieller Build) (64-Bit)
- Application Server (if applicable): Springboot/Embedded Tomcat
- IDE (if applicable): Eclipse
Metadata
Metadata
Assignees
Type
Projects
Status
Status