I've created an LWC wrapped in an Aura Component so that I can navigate directly to it as a tab (see 2nd part of answer here). Everything works just fine, except that: when I'm 1) opening it as a subtab, the "Refresh Tab" works just fine; but when I'm 2) opening it as a main tab, "Refresh Tab" does nothing:
Here's the difference between the 2 places I'm using it (remember this is the same exact component, just used in 2 slightly different contexts):
- As a subtab (#1) - I'm Navigating from one component ("Order Det...") in the screenshot and opening a new subtab ("ZCR") - this is all within the main Account tab (shown here as "Richard Doyle").
- As a main tab (#2) - the main "ZCR" tab that #2 in the screenshot is pointing to is opened from a record list - I've edited the content of the page that opens when clicking on one of the items in the record list (a Record Page using my custom object). I replaced the default content with my Aura-wrapped LWC component.
Why is "Refresh Tab" working in #1 but not #2? Is there any workaround for this?
I've even tried capturing the refresh event in the Aura component and then manually refreshing via $A.get('e.force:refreshView').fire();
, but the event never seems to fire. I tried something like:
<!-- Aura Wrapper - Component -->
<aura:component implements="flexipage:availableForAllPageTypes, force:appHostable, lightning:isUrlAddressable, force:hasRecordId">
<aura:handler event="force:refreshView" action="{! c.handleRefreshView }" />
...
...
</aura:component>
<!-- Aura Wrapper - Controller-->
handleRefreshView: function (component) {
alert('refreshView event triggered!');
$A.get('e.force:refreshView').fire();
},
And the handleRefreshView
handler never gets hit.
Which event gets triggered when "Refresh Tab" is clicked? Can I capture this?
NavigationMixin
from another custom component while #2 is actually just an object's record page (which your component happens to be on?)