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

When using a single navbar for all applications, repeated navigations within a single app fail #49

Closed
StephenRansom opened this issue Apr 8, 2019 · 4 comments · Fixed by single-spa/single-spa#291

Comments

@StephenRansom
Copy link
Contributor

This occurs when you have a single navbar app that controls navigation between multiple applications, including their subroutes.

The first navigation to any app or app subroute completes successfully. Any subsequent navigation inside that same app will fail. For example:

/app1 -> /app2 -> /app1 will succeed.

/app1 -> /app1/subroute will fail to load the subroute.

/app1 -> /app2 -> /app1/subroute will succeed.

In other words, navigation switching between apps works fine, but subsequent navigations within a single app (from routes on the navbar) will fail until you first navigate outside of the app.

@HemTech
Copy link

HemTech commented Apr 8, 2019

I am able to navigate within app but it logs exception when navigate between multiple applications:

core.js:15724 ERROR Error: Expected to not be in Angular Zone, but it is!
at Function../node_modules/@angular/core/fesm5/core.js.NgZone.assertNotInAngularZone (core.js:17197)
at Object.next (core.js:17403)
at SafeSubscriber.schedulerFn [as _next] (core.js:13515)
at SafeSubscriber../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:196)
at SafeSubscriber../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:134)
at Subscriber../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:77)
at Subscriber../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:54)
at EventEmitter../node_modules/rxjs/_esm5/internal/Subject.js.Subject.next (Subject.js:47)
at EventEmitter../node_modules/@angular/core/fesm5/core.js.EventEmitter.emit (core.js:13499)
at core.js:17274

StephenRansom: kindly share sample of your main.ts and route files. it seem an issue with our configuration.

@StephenRansom
Copy link
Contributor Author

@HemendPatel63 Are you using the most recent beta (12 at this time), and are you doing all of your navigation from a single navbar app? If I have a navbar that only contains links to each app root, and each subapp does it's own routing (from a self contained navbar), I don't encounter issues. It's only when I do all routing from the separate navbar app that I encounter this issue. I'll post a sample when I get a chance though. (for reference, https://github.com/StephenRansom/single-spa-beta-tabbed-app-navigation works fine)

@StephenRansom
Copy link
Contributor Author

I made a copy of joel's example app and added subroutes to demonstrate what I'm seeing. (you can also just ng g component subroute in one of your applications to quickly test it yourself, just don't forget to add the routes in). Click around between the app1 subroutes, then try clicking between app1 -> app2 -> app1/subroute -> app2 etc https://github.com/StephenRansom/single-spa-routing-issue-example

@joeldenning
Copy link
Member

Yeah beta.12 should solve the "Expected to not be in Angular Zone, but it is!" issue. I'll take a look at that example repo for the issue described for subroutes.

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

Successfully merging a pull request may close this issue.

3 participants