Best practice for rootPage and lazy loading

We are using Ionic3 with lazy loading and we were wondering how to handle the case when the user is navigating say: and they refresh that page.
If we use something like this, the problem is that the rootPage is first set to ExamplePage (due to the URL), but then it is automatically changed to WelcomePage.
After some changes, we got to the following solution but we aren’t sure it is the best way to do it.

  selector: 'page-menu',
  templateUrl: 'app.html'
export class MyApp {
  @ViewChild(Nav) nav: Nav;

  rootPage: string = WelcomePage;

    private userProvider: UserProvider,
    private platform: Platform,
    private splashScreen: SplashScreen
  ) {
    this.platform.ready().then(() => {
      this.userProvider.isAuthenticated().then((isAuthenticated) => {
        if (!isAuthenticated && this.nav.root !== LoginPage) {


Is there any solution for this.