navCtrl.getActive().component.name Returns Single Letter for Production Build
I would like to share a problem we faced and how we resolved it.
Client reported that every time they launched the application the login screen which was the first screen after splash popped up twice. It occurred in later versions, not in the earlier versions.
How we identified what might be creating the problem:
In the token interceptor file we were checking the error that whenever a 401 error occurs and the active screen is not 'login' then it should be navigated to login screen which was absolutely fine.
On every relaunch of application, there were 2 API’s being hit.
So, we assumed that this could be the issue. But checking the code all looked fine.
We added console.log to check the activeComponent.name
This was surprising, the log displayed a single letter ‘q’.
So when 2 API’s were hitting, and the authorisation failed, the code written in the error block was called twice, and since the name of the active component was ‘q’, the if condition passed, and it popped to login twice.