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

Infinite router redirect loop #5

Closed
MykolaShevchuk opened this issue Jul 2, 2019 · 14 comments
Closed

Infinite router redirect loop #5

MykolaShevchuk opened this issue Jul 2, 2019 · 14 comments

Comments

@MykolaShevchuk
Copy link

MykolaShevchuk commented Jul 2, 2019

I've noticed one critical issue with a router in "coexisting-angular-microfrontends" project:

When I switch quickly from app1 to app2 and switch back to app1 before app2 was completely loaded and rendered I'm getting into an infinite redirect loop.

Here is a demo:

Could you suggest anything?
Thank you!

@joeldenning
Copy link
Owner

Hey @MykolaShevchuk, I have seen issues sort of similar to this but have struggled to replicate the issue. I just tried this again on coexisting-angular-microfrontends.surge.sh, but was unable to see the problem.

Any tips on how to get this to happen consistently? I would definitely like to fix the problem.

@MykolaShevchuk
Copy link
Author

Thank you @joeldenning. I can reproduce it on http://coexisting-angular-microfrontends.surge.sh

Steps to reproduce:

  1. Open http://coexisting-angular-microfrontends.surge.sh/ and with not loaded "App 1"
  2. Click "App 1"
  3. Click "Home".
  4. And here is happening something strange:
    If you had clicked "Home" after "App1" was fully loaded - everything is fine;
    if you had clicked "Home" very very fast - everything is fine;
    if you had clicked "Home" after small delay like 500ms - it starts redirect loop between '/' and '/app1'.

@joeldenning
Copy link
Owner

I was able to replicate this error only one time after about 20 attempts. Afterwards, I upgraded all of the single-spa applications in this repo to Angular 8.

Could you verify if you can still replicate the error, now that everything is upgraded to Angular 8? I think I don't know the click timing as well as you do 😄

@nashvillenarayan
Copy link

Hello Joeldenning,
We are also facing the same issue . we are using five applications which are built on Angular-7.2. It is happening sporadically , i feel it is not issue with click timing or delay of loading.

@joeldenning
Copy link
Owner

@nashvillenarayan any information that you could provide that would help me replicate this issue reliably would be appreciated.

@MykolaShevchuk
Copy link
Author

@joeldenning I've just tested updated version with angular8. Unfortunately, it's still reproducible.

@joeldenning
Copy link
Owner

Hmm I will try to find some time to figure out how to make this consistent to reproduce.

@joeldenning
Copy link
Owner

I just tried to recreate the problem and was unable to do so. Until there is a way to consistently demonstrate the problem, I will be unable to fix it.

@ywager
Copy link

ywager commented Jul 30, 2019

Hi Joeldenning,
I also encountered this problem, using angular7.
I have uploaded my code to github(https://github.com/ywager/angular-microfrontends), and the steps and problems have been described in the project README. If you are comfortable, you can test it.

@joeldenning
Copy link
Owner

👍 I'll check it out the next time I get a chance.

@joeldenning
Copy link
Owner

This might be related too image

https://github.com/korjikk/angular-single-spa-routing-issue

@AndrewGlazier
Copy link

Hi @joeldenning, I'm also experiencing this issue;

Things I've found which assist with reproduction:
IE11 reproduces this issue more consistently
Making the button swap on click so you can simply double click makes the timing more easily replicable

@AndrewGlazier
Copy link

Have opened this ticket with more details:
single-spa/single-spa-angular#113

@joeldenning
Copy link
Owner

I do not have time to work on this issue. In the past I've spent >30 hours trying to get Angular Router and ZoneJS to not behave weirdly. The root cause of the bug is that ZoneJS monkey patches all of the native browser functions and makes assumptions about who is calling those functions (and when) that do not hold true with single-spa. I have little interest in attempting to work on this issue again in the near future, since I'm swamped with other work and this bug is a frustrating one I've already lost a lot of time to.

I would gladly accept a PR from the community to fix this. Since we now have single-spa/single-spa-angular#113, I'm going to close this issue in favor of that one.

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

5 participants