Angular preventNavigation does not work as expected
Describe the bug or question single-spa:before-routing-event fires after the url has been changed but before unmounting and mounting. Calling cancelNavigation doesn't cancel the navigation. The navigation has occurred and the url has changed.
cancelNavigation instead cancels the unmount and mounting that would have occurred during the routing change and initiates a new routing event back to the previous route.
When logging the events and the mounting state the single-spa logs also do not reflect the actual mounting state but assumes the unmount/mount will occur. I added additional logging to the angular module to log when mounting actually occurs to demonstrate the difference
Issues
- "single-spa:before-routing-event" occurs after location.href has changed
- cancelNavigation fires another "single-spa:before-routing-event" which can create an infinite loop
- getMountedApps() returns incorrect mount state
To Reproduce
To reproduce create a new single-spa application with angular microfrontends, listen to the event single-spa:before-routing-event and call cancelNavigation() for all attempted route changes. console.log the events and notice the infinite loop of routing events.
Or clone this repo and follow the instructions in the Readme.md Repo: single-spa-angular-routing-bug Quick setup: clone repo, npm i, npm start
Expected behavior single-spa:before-routing-event should fire before any routing event and before any url change. cancelNavigation should prevent the navigation from happening instead of going back to the previous navigation
Screenshots and/or console output

Additional context
- The example does not use single-spa layout.html
- reproduced with angular@14 and single-spa-angular@7
Facing the same issue with angular@16 and single-spa-angular@9