2

I've an Ionic/angular project that I paused for a while. I resumed working on it, but I've an error coming in the console. The user effect is that nothing is displayed for 10-15 seconds, then my google is loaded, but then I see no disfunction.

core.js:4197 ERROR RangeError: Maximum call stack size exceeded
    at MapSubscriber._error (Subscriber.js:75)
    at MapSubscriber.error (Subscriber.js:55)
    at MergeMapSubscriber.notifyError (OuterSubscriber.js:7)
    at InnerSubscriber._error (InnerSubscriber.js:14)
    at InnerSubscriber.error (Subscriber.js:55)
    at CatchSubscriber._error (Subscriber.js:75)
    at CatchSubscriber.error (Subscriber.js:55)
    at CatchSubscriber.error (catchError.js:32)
    at MergeMapSubscriber.notifyError (OuterSubscriber.js:7)
    at InnerSubscriber._error (InnerSubscriber.js:14)

I've searched a bit, I've updated from angular 10 to angular 11, updated all the libraries, found quite a lot of answers on stackoverflow, including this one Angular 7 error RangeError: Maximum call stack size exceeded

But I've no idea where area would cause the issue.

I tried to comment everything on the ngOnInit/constructor of the page I'm on, without any success.

How can I find the rootcause of such error? I'm really lost and I don't know what to do, this just freeze my app for 10-15 seconds then crashes.

I've a firebase timeout just after this, but I guess it's because angular was to busy to handle this call-stack issue.

J4N
  • 19,480
  • 39
  • 187
  • 340
  • It means that there is an infinite loop somewhere in your code. If it happens everywhere there is a high chance that it comes from service. – Ploppy Jan 04 '21 at 11:55
  • @Ploppy I don't have any service yet, I'm using NGXS, connected to firebase, so currently I only had to dispatch actions and connect the result. Any idea of something I could activate or trace to see where it's coming from? Why don't I see anything in the call stack? – J4N Jan 04 '21 at 12:02
  • Typical this happens when, in a ReactiveForms one control depending another -or disabled a control- and you make a setValue without {emitEvent:false}- it's lloks like your problem is related with a swithMap in an observable, but I don't know how you can check where the problem is – Eliseo Jan 04 '21 at 12:20
  • @EliseoI just commented every switchMap in my solution, ran the ionic serve again, but I still got the issue :'(. Also, I only one form(login form) but I'm already logged in and no form is displayed) – J4N Jan 04 '21 at 12:47

1 Answers1

3

It's not an universal answer, but I hope it can gives some example:

In my case, I was reference Module A from Module B and Module B from Module A, so this cyclic reference was resulting in a stack overflow which had this result.

J4N
  • 19,480
  • 39
  • 187
  • 340