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

cancelNavigation() event is not working properly , removes the app from DOM #180

Closed
deepan094 opened this issue Oct 19, 2022 · 2 comments
Closed

Comments

@deepan094
Copy link

The issue is that when tried to cancel navigation from /app1 to /app2 . It prevents from navigating to /app2 but ( /app1) is removed from the DOM . URL remains /app1

"single-spa": "5.9.4",
"single-spa-layout": "2.1.0",

Code :

_listner(ev){
    if (
      new URL(ev.detail.oldUrl).pathname === '/app1'
    ) {
       if (confirm('Are you sure you want to go back?')) {
          console.log('Yes');
        } else {       
          ev.detail.cancelNavigation();
        }
    }
}
    window.addEventListener(
      'single-spa:before-routing-event',
      this._listner
    );

Any suggestions/advice would be greatly appreciated! @joeldenning
Thank you!

@malthoff
Copy link

malthoff commented Feb 6, 2023

Experiencing the same. It removes the app from the DOM, even the used framework does not get informed (like unMount or something). This is a huge issue, how can I upvote?

@joeldenning
Copy link
Member

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

3 participants