1

Is there any hidden event available to be subscribed in order to capture when the user selects a tab from the standard tab component(added from the app builder)

Inside each tab, we've placed our own LWC components. If an event is available, we can implement the handler for that inside all the content components and get our work done.

Note: some of the options like currentPageReference and renderedCallBack seems not working probably as we need this in the service console.

2 Answers 2

0

connectedCallback lifecycle hook is called the first time the component loads, but there's no guarantee when that will be called. The renderedCallback handler should fire each time a tab becomes active, but of course, will also fire each time a wire method refreshes the component or any tracked properties update, so you'd have to account for that. In summation, there doesn't appear to be any guaranteed, dedicated event you can listen for.

2
  • Thanks @sfdcfox, I think I missed the important information that we are trying this inside the service console tab. renderedCallback not firing from the second time onwards when we come back to a last visited tab
    – highfive
    Sep 22, 2022 at 15:06
  • @highfive A screenshot of what you're trying to do exactly would be helpful. I've made some assumptions based on your wording.
    – sfdcfox
    Sep 22, 2022 at 18:43
0

I am using the following method to detect when tab is changed

import { CurrentPageReference } from 'lightning/navigation';

@wire(CurrentPageReference)
setCurrentPageReference(currentPageReference) {
    this.currentPageReference = currentPageReference;
}
1
  • Thanks @Patlatus, I forgot to mention that we are trying this inside the service console. The shared approach is not working in the console application unfortunately
    – highfive
    Sep 22, 2022 at 15:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .