How to remove white screen after window.location.reload(); in ionic 4

I want to reload the page after calling API in ionic 4.

When the app starts after the splash screen white screen is removed by adding this in config.xml

<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="30000" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashScreen" value="screen" />
<preference name="ShowSplashScreen" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="FadeSplashScreen" value="true" />   

After login, it navigates to the tabs pages, In tab1 I check if the user is approved by an admin or not and according to that value message is shown on the screen.

In tab1 I am using ion-refresher to refresh the page and call API to check whether the user is approved or not.

For update UI of the screen on success if API I call :


But an issue is that after reloading page white screen appears for a while.

How to remove that white screen?


<ion-refresher #refresherRef slot="fixed" (ionRefresh)="load($event)">
    pullingText="Pull to refresh"

  <div *ngIf="userData.userStatus == 2" class="emplty_class">
    Your request has been pending.

  <div *ngIf="userData.userStatus == 1">
    Your request is approved.


load(refresher) {
    if(this.userData.userStatus == "2"){
      let postData = new FormData();
      postData.append('user_id', this.userData.userId);

      this.authService.postData(postData, "is_verified_or_not.php").then((result) => {
        this.responseData = result;

        this.success = this.responseData.success;
        if (this.success == 1) {
          // refresher.complete();
          let userDeatil = this.responseData.users_details;
          localStorage.setItem('userData', JSON.stringify(userDeatil));
          for (let data1 of userDeatil) {
            this.userStatus = data1.status;
            localStorage.setItem('userStatus', JSON.stringify(this.userStatus));
            console.log("userStatus" + this.userStatus);
          if(this.userStatus == 1){
        } else {
          this.message = this.responseData.message;  
      }, (err) => {;
        console.log("Error", err);
    } else{;
      console.log("User is already approved: " + this.userData.userStatus);

This is roughly the equivalent of a hydrogen bomb. You are asking the device to completely reload your app from scratch. Hence:


Figure out a less drastic way to achieve your underlying goal that does not involve calling location.reload().

In tab1 I am using ion-refresher to refresh the page and call API to check whether the user is approved or not.

After refreshing page API is called if the user is approved then the status is changed in local storage but my UI is not changed. After closing an APP the UI is changed or if I am checking it in localhost then after refreshing that page.

My purpose for doing this is to refresh UI instant after the response

How to update UI instant after calling an API.

Can you please suggest any other way of doing this.

Apologies if this is over-parsing, but if you require the result of the response to that API call in order to display something new, you (sort of by definition) can’t do anything instantly after calling. You can’t even do anything instantly after the response comes, but I use this strategy to propagate changes across an app, which is close enough to “instant” for me. I would also suggest this post to you, discussing performance implications of using on-device storage during normal app operation (executive summary: I recommend not doing that).

I just tested window.location.reload true within my apps logout function and it works fine also within the actual app.