-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Router State in Store when using Resolve #358
Comments
Hi @brandonroberts @MikeRyanDev
However, I have question why we had hook on beforePreactivation if we change it to postPreactivation then effect will be fired after guards and resolves. Is it okay ? Will this impact the initial design in mind ? |
Hey @roopkt. The idea for the for the resolve action is to add an additional listener for the |
Thanks! @brandonroberts got it I will work on this. |
@roopkt after some thought I leaning towards not bringing this into the library. Using resolvers with ngrx is considered an anti-pattern, as you should use guards/effects to push data into the store. |
@brandonroberts Thanks |
A question : I don't understand why use the guards instead resolvers to push data into store. The role of guards is to forbid access to a route, while role of resolver is to retrieve data needed for a route. |
Relates to #816 |
I agree with @fredgate, using resolvers seems to be much better option to retrieve data. @brandonroberts why is it considered anti-pattern (and not supported by library)? I just hit this limitation and it gives me a lot of trouble :( |
I'm submitting a...
What is the current behavior?
When using
resolve
withinRoute
,data
property doesn't include the result ofresolve
in the store.Expected behavior:
When using
resolve
,data
property should be updated with the result from it.Minimal reproduction of the problem with instructions:
Example route:
userName
doesn't exist indata
property ofActivatedRouteSnapshot
within the store.Version of affected browser(s),operating system(s), npm, node and ngrx:
@ngrx/router-store: 4.0.4
Other information:
I've noticed that even the serializer doesn't receive router state with updated
data
property.The text was updated successfully, but these errors were encountered: