Loader Integration with Vaadin-Flow

hi guys, i am looking for integration of loader using vaadin flow, i got some hint from vaadin site and able to add the loader in my application but i am not sure whether the implementation is correct or not.
Current Implementation :
i have integrate the loader and it’s working fine in client side but i wants to implement it on Server Side as well.
Scenario :
i have sidebar and when i click on any menu (TAB) then loader should keep shown once the data get load on another page then loader should be disappear. suppose i have four menu (m1,m2,m3 and m4) currently i am on m1 which can be called active menu and i click on m3 the loader is populating and till the respective page loading of m3 will not load the loader will be keep shown and after that it will disappear and its working fine as well, now i am on m3 which can be called active, if i click again on m3 which is already active then the loader again show but it’s not disappearing because in the recent click request is not going on server so i will not get any response and due to this i am unable to stop the loader.
Here is my code :

  css
     .removeLoader {
      display:none;
 }
  
   _closeMenu() { //for display loader
    this.$.loaderIndicatorId.classList.remove('removeLoader');
  }
  
   removeLoaderIndicator() { //for remove loader
      this.$.loaderIndicatorId.classList.add('removeLoader');
   }

public class HomeView extends PolymerTemplate<HomeView.HomeViewModel>
implements BeforeEnterObserver, AfterNavigationObserver {

@Override
public void afterNavigation(AfterNavigationEvent arg0) {
    getElement().getParent().callFunction("removeLoaderIndicator");
}

}