@loki9182 wrote:
In short, the problem that I'm having is that, when I use "ionic serve -c -l" or "ionic cordova run android -c -l", it runs fine the first time but I run into problems when ever I make changes to the code and it live-reloads.
The problem is that my "app.component" need to do a few async operations before displaying my first page (like figuring out which data server url to use for transactions (dev or prod)). After completing, it displays the first page where the ionViewDidLoad sends an http request to the data server url and then I display my data. I'm now working on implementing Lazy Loading and the problem I'm having is that now when ever I modify some code and it rebuilds/reloads, it stays on the page where it was but seems to reset everything else (including my dataProvider and the data server url). This has the effect that my since it restarts the app from the last page I was on, my ionViewDidLoad tries to fire the transaction again but the root code hasn't had time to get my data server url (so I get an error!). A few ms later, I see the root code finish running and displaying the first page again (which now runs fine since my data server url is now set).
The annoying result is that now when ever I modify code, it rebuilds/reloads and I get an error that pops up on screen. I have noticed (with "serve") that the url in the address bar follows the page you are currently viewing such as http://localhost:8100/#/nav/n4/home
When I modify code and it rebuilds/reloads, it stays at this address while the app.component code runs. Is this how things work now? Or am I doing something wrong? I know this won't happen when the app runs in production without live-reload but during development, this is annoying as hell! Is there a setting I can change to tell Ionic to go back to the root page when ever I rebuild/reload? Just like it used to do with Ionic 2?
Posts: 2
Participants: 1