This post most probably only apply on app where an authentication is mandatory
I just add an idea, implemented it and it seems that I gained 200-300ms seconds (7.5%) on my boot time.
Look quite promising but I wanted to share it to know if you think guys, that it could be a good idea or if you see any risks of doing following this implementation aka is that a bad idea?
I’ve got an app where the login is mandatory. First time user have to log in, then with token automatic login.
If I’m not wrong the most classical way to solve that is to implement a LoginPage. If user log for the first time, the page is displayed till user process what he has to do (clicks). On next app starts, if token is used, same page is displayed with a spinner while in the background the login is automatically is processed.
In app.component, the element “rootPage” is, again if I’m not wrong, mandatory. So the most classical way to achieve the above process is to set then the “rootPage=LoginPage” even if on automatic login, the LoginPage wouldn’t be really needed. Means that even when an automatic login as to be performed, the LoginPage still gonna be rendered (right?)
But today I noticed that, even my LoginPage just render a spinner while doing the automatic login, it still took a bit of time to be processed (from ionViewDidLoad to ionViewDidEnter or ionViewDidLeave) because even if I only display a spinner, there is still some work to do to not render the rest of the page (like in my case, which you probably have to, my login page contains a slider to display informations about the app).
Ultimately, I thought that, that time could be saved in case of an automatic login, so I just created a DummyPage empty which I set in app.component as root (rootPage=DummyPage).
The DummyPage takes now care to process the login status. If new or token expired, this DummyPage set then the root to the login page, else the DummyPage process an automatic login and set then the next page as root.
Of course, to make a not to ugly login, I let the DummyPage be renderer behind the splash screen, therefore the user never (or should never) see it (here I’m not 100% sure…)
As a result, I could notice that I save around 200-300ms (7.5% of my overall boot time) which in my point of view, is a good quick small win.
So again, anyone see a risk in that implementation?