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

Async guard executed twice when navigating back #365

Open
pawelbialaszczyk opened this issue Jun 2, 2021 · 0 comments
Open

Async guard executed twice when navigating back #365

pawelbialaszczyk opened this issue Jun 2, 2021 · 0 comments

Comments

@pawelbialaszczyk
Copy link

Background

Whenever there's an async result returned from a guard (i.e. an Observable) attached to a route that's being navigated back to (i.e. by clicking the browser's back button), that guard is executed twice (first navigation event gets canceled). This results in breaking the browsing history.

Demonstration

I've pushed a minimal example forked from the official template: https://github.com/pawelbialaszczyk/coexisting-angular-microfrontends. Used the latest single-spa, single-spa-angular and angular versions.

Repro steps:

  1. Start app1 locally
  2. Navigate to http://coexisting-angular-microfrontends.surge.sh
  3. Override app1 module URL to use the local one
  4. Open the browser's dev tools (console view)
  5. Click App1
  6. Click Go to test-1 (notice in console the guard is executed once)
  7. Click Go to test-2
  8. Click Go back (notice in console the guard is executed twice)

Expected Behavior

When clicking Go back the guard is executed once

Actual Behavior

When clicking Go back the guard is executed twice

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

No branches or pull requests

1 participant