Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Add a way to easily reload the resolver #444

@tbnovaes

Description

@tbnovaes

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions