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
replaceUrl not preserved in redirect #53503
Comments
Indeed, this is also true of all the other properties in Changing this behavior would need to land in a major version. We would also need to do some preliminary tests to determine how breaking it is and decide if the change is worth making based on the results. |
I ran tests inside google and found that updating |
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
Hi, @atscott I have pushed a pull request for this, please let me know if it needs any changes. |
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503 BREAKING CHANGE: When a a guard returns a `UrlTree` as a redirect, the redirecting navigation will now use `replaceUrl` if the initial navigation was also using the `replaceUrl` option. If this is not desirable, the redirect can configure new `NavigationBehaviorOptions` by returning a `RedirectCommand` with the desired options instead of `UrlTree`.
…ivate This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503 BREAKING CHANGE: When a a guard returns a `UrlTree` as a redirect, the redirecting navigation will now use `replaceUrl` if the initial navigation was also using the `replaceUrl` option. If this is not desirable, the redirect can configure new `NavigationBehaviorOptions` by returning a `RedirectCommand` with the desired options instead of `UrlTree`.
…ivate (angular#54042) This commit will fix the issue of the setting of NavigationExtras.replaceUrl being lost when returning a urlTree from a CanActivateFn. Fixes angular#53503 BREAKING CHANGE: When a a guard returns a `UrlTree` as a redirect, the redirecting navigation will now use `replaceUrl` if the initial navigation was also using the `replaceUrl` option. If this is not desirable, the redirect can configure new `NavigationBehaviorOptions` by returning a `RedirectCommand` with the desired options instead of `UrlTree`. PR Close angular#54042
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
If I call
router.navigate
withreplaceUrl: true
, and if I have aCanActivateFn
that returns aUrlTree
, the resulting redirect loses thereplaceUrl
setting.The relevant code is here:
angular/packages/router/src/router.ts
Lines 196 to 201 in e3a6bf9
I can fix the issue by using
replaceUrl
setting if it's defined:Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-ih775l?file=src%2Fmain.ts
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: