I have two parent components which use the same child components but with different attributes for the child component. I have created a lightning tab to open each lightning component. Now when I switch from one tab to another, the new component still gets some of the styling and attributes of the other parent component. i.e. some elements like outputtexts and event data in the child components do not refresh, It is only when I refresh the page manually, the parent and child components work as expected including page styling. How do I clear the existing data or cache or refresh the page while switching tabs.
Since the components are big and extensive, adding the code will b difficult, but I will try to explain the flow.
There are two Parent Components Component A and Component B having their own lightning tabs.
Both of these components reuse the same child components Component C and Component D(Data table) having different default values for their attributes(for eg object name).
Component A and B dont have a custom init handler or rendering , but the child components have their own
afterscriptsloaded handler which acts as their
inits and hence load their own. The parent components just pass corresponding default value of the attributes and handle some events differently.
The child components have some styling and outputtexts which are updated dynamically in the js controllers of the child components according to the data and values of the attributes. Now this is not getting updated while switching tabs until I refresh the page(F5) and as dhanajay's case causing the browser to crash at times. Most of the functionality is working as expected while switching tabs and the data in the data table is populated correctly but some of the functionality isn't and the crashing is intermittent.
EDIT 2: The problem with $A.get('e.force:refreshView').fire(); is that it refreshes all the siblings and parent causing a sort of an infinite loop. Is there a way to just refresh the specific child component without adding refresh handlers in every other component?