Look at the route setup below:
const routes: Routes = [
{
path: '',
component: AppComponent,
resolve: {
app: AppResolver
},
children: [
{
path: 'user/:uid',
resolve: {
user: UserResolver
},
children: [
{
path: '',
component: ViewUserComponent
},
{
path: 'edit',
component: EditUserComponent
}
]
}
]
}
];
The user information is fetched using UserResolver
for any child routes of /user/:uid
.
This allows users to view a profile by going to /user/:uid
and then edit it by visiting /user/:uid/edit
.
After editing, one would expect to see the updated profile (/user/:uid
).
However, since both the view and edit pages are children of the resolved route, the resolver doesn't trigger when moving between them.
As a result, returning from the edit page to the view page still shows the old data.
Is there a way to refresh the resolved user
data to fetch it again from the server? Alternatively, is there another solution to achieve this outcome?
Since the app
data remains unchanged, reloading should not be necessary.