-
Notifications
You must be signed in to change notification settings - Fork 27.2k
onSameUrlNavigation doesn't re-load routed components #21115
Copy link
Copy link
Closed
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: routerfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq3: high
Milestone
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: routerfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq3: high
I'm submitting a...
Current behavior
I'm trying to use the new onSameUrlNavigation flag in 5.1.1, and while it does repeat the RouterEvent cycle, it doesn't trigger any lifecycle events in the routed components
Expected behavior
ideally if it's going to trigger a reload, it should re-initialize any routed components.
Minimal reproduction of the problem with instructions
imports: [RouterModule.forRoot([
{ path: "", component: HomeComponent, pathMatch: "full" },
{ path: "login", component: LoginComponent },
], { onSameUrlNavigation: "reload" })]
This configuration will not trigger lifecycle events in LoginComponent if there's a link to LoginComponent somewhere on the page
What is the motivation / use case for changing the behavior?
This flag was added to support refresh, but developers would still have to listen to the router event cycle to be able to refresh any components this way
Environment