function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KevanMKevanM 

Lightning component in Lightning service console being refreshed when changing primary tab

If you have a lightning component on a layout of a subtab in Lightning service console and you change from one primary tab and came back to the previous one, the Lightning component on the layout refreshes by itself. Can we prevent this behaviour? 
Raj VakatiRaj Vakati
HI Keven, 
I think you can do it with the compoment life cycle. But honestly, i haven't tried it completed. Please refer the below code and let me know will this helps you or not.
({
    afterRender : function(component, helper) {
       this.superAfterRender(); 
       var targetEl = component.find("mainapp").getElement();
       targetEl.addEventListener("onhashchange", function(e) {
            e.stopPropagation();
        }, false); 
    }
})








 
KevanMKevanM
@Rajamohan.Vakati
The above code is not working since we don't have the id of the main component.