I use the resolver to pre-fetch some data so when component is loaded I don't have things popping like xmas tree on the screen. All works fine, things are great, everybody is happy.
Sad path
I use the resolver to pre-fetch some data, api returns me any http error and no data. Things don't go as expected, I have no data to display, everybody is sad.
In this case I don't want to send the user to an error page, instead I want to load the same page, but customized with an error message and a reload button that will reload my resolver and maybe this time everything will work fine and people will be happy.
Workarounds
So I know that there are workarounds to the problem, but all come with some caveat, for example:
we could change navigationStrategy to 'reload', but it would add a lot of extra work to avoid the parent to reload when user is navigating to a child.
we could add a refresh param with the timestamp, but it would add an extra params and also would need to change the navigationStrategy, which would put us back on the previous bullet point issue.
There are few others, but all add a lot of extra steps. Which may be fine when we are talking about just one route of the entire app, but not fine when you have to do it in multiple routes. Which also generates a lot of boilerplate.
Expected
It would be great to have some way of forcing the route to reload its resolver. Something like activatedRoute.resolve()
Happy path
I use the resolver to pre-fetch some data so when component is loaded I don't have things popping like xmas tree on the screen. All works fine, things are great, everybody is happy.
Sad path
I use the resolver to pre-fetch some data, api returns me any http error and no data. Things don't go as expected, I have no data to display, everybody is sad.
In this case I don't want to send the user to an error page, instead I want to load the same page, but customized with an error message and a reload button that will reload my resolver and maybe this time everything will work fine and people will be happy.
Workarounds
So I know that there are workarounds to the problem, but all come with some caveat, for example:
we could change navigationStrategy to 'reload', but it would add a lot of extra work to avoid the parent to reload when user is navigating to a child.
we could add a refresh param with the timestamp, but it would add an extra params and also would need to change the navigationStrategy, which would put us back on the previous bullet point issue.
There are few others, but all add a lot of extra steps. Which may be fine when we are talking about just one route of the entire app, but not fine when you have to do it in multiple routes. Which also generates a lot of boilerplate.
Expected
It would be great to have some way of forcing the route to reload its resolver. Something like
activatedRoute.resolve()