Skip to content
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

Router deactivate failure results in page reload in computed mode #54835

Open
joeldhenry opened this issue Mar 12, 2024 · 2 comments
Open

Router deactivate failure results in page reload in computed mode #54835

joeldhenry opened this issue Mar 12, 2024 · 2 comments

Comments

@joeldhenry
Copy link

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

No

Description

with routerModule as default, a deactivate failure, would still remove the history state causing issues with back button and swipe back on mobile.

as per instructions, i changed to RouterModule.forRoot(AppRoutes, { canceledNavigationResolution: 'computed' })
which results in history being reset on deactivate failure, however the page also refreshes causing form data and state to be reset. my understanding is that default deferred update strategy and sameURLNavigation 'ignore' should have caused the route to not be reloaded, however this is not the case.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

routerModule as default:

Route Page 1 -> Page 2
Route Page 2 -> Page 3
Back & deactivate Failure = history state Page 2

canceledNavigationResolution 'computed':

Route Page 1 -> Page 2
Route Page 2 -> Page 3
Back & deactivate Failure = history state Page 3, but refresh page 3

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 16.1.6
Node: 18.18.0
Package Manager: npm 9.8.1
OS: darwin arm64

Angular: 16.1.7
... animations, common, compiler-cli, core, language-service
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1601.6
@angular-devkit/build-angular   16.1.6
@angular-devkit/core            16.1.6
@angular-devkit/schematics      16.1.6
@angular/cli                    16.1.6
@schematics/angular             16.1.6
rxjs                            7.8.1
typescript                      5.1.6
zone.js                         0.13.1

Anything else?

No response

@atscott
Copy link
Contributor

atscott commented Mar 13, 2024

my understanding is that default deferred update strategy and sameURLNavigation 'ignore' should have caused the route to not be reloaded, however this is not the case.

not quite in this case because the URL is changing so the route is processed. This now depends on what you’re doing with the RouteReuseStrategy. Can you provide a reproduction?

@ngbot ngbot bot added this to the needsTriage milestone Mar 13, 2024
@yashnsharma
Copy link

yashnsharma commented Jun 3, 2024

I am facing simililar issue with my application after using canceledNavigationResolution: 'computed' Flag.

The application has two routes, one route displays a reactive form other route embeds an iframe.
When the user lands on the iframe route and uses the browser back button to navigate back, Instead of navigating the application just reloads on the same page. Basically after that the user is stuck.

Also this issue is not observed while developing on localhost, It is observed when It's hosted behind our testing domain which uses nginx as a load balancer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants