Change address in address bar without navigation

Can i somehow change address in address bar to my App Layout route after navigation from child route to it, without re-navigation?
My app layout addres is like: localhost:8080/mainPage class MainPanelLayout

Child route: localhost:8080/mainPage/subPage and** @Route(layout = MainPanelLayout.class,value = “subPage”)**

After writing address localhost:8080/mainPage/subPage i want to run code from Child route but after completing code i want change link again to ** localhost:8080/mainPage**.

I can`t use history like:
UI.getCurrent().getPage().executeJs(“history.pushState(history.state,‘’,'” + “mainPage” + “');”);
Couse then my listeners like onDetach in MainPage are stopping working, so after reloading MainPage is executing from beggining without my code from Child class executed before.


If this is just a functional url in your application and is not supposed to have any viewable content, then one potential solution is that you implement BeforeEnterObserver in your subPage and put the code in beforeEnter() method, and after that just use forwardTo back to the mainPage.

But will it execute my setParemeters method? Coouse sometimes i can have some parameters in link that will be used in current subclass. And this subPage is creating view for tab used in mainPage. After entering to subPage link new Tab is created in mainTab